#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
	
	int n;
	cin>> n;
	
	vector<int> ml(n,0), fl(n,0);
	
	for(int i=0; i<n; i++){
		cin>>ml[i];
	}
	for(int i=0; i<n; i++){
		cin>>fl[i];
	}
	
	sort(ml.begin(), ml.end(), greater<int>());
	sort(fl.begin(), fl.end());
	
	int pm=0,pf=0;
	
	// for(int i=0; i<n; i++){
	// 	cout<<ml[i]<<" "<<fl[i]<<endl;
	// }
	
	int count = 0;
	
	while(pm<n && pf<n){
		int m = ml[pm];
		int f = fl[pf];
		
		// can be pairs??
		if(m*f<0){
			// they meet their choice?
			if(m<0){
				if(-m>f){
					count++;
					cout<<pm<<" "<<pf<<endl;
					pm++;
					pf++;
					
				}
				// m is -ve, f is +ve but |m| <= |f|
				// ab right me hi ja skte h.
				// right me |m| will increase.
				// right me |f| will increase.
				// we want larger m and smaller f
				else{
					pm++;
				}
			}
			else{
				if(m<-f){
					count++;
					cout<<pm<<" "<<pf<<endl;
					pm++;
					pf++;
				}
				// m is +ve, f is -ve but |m| >= |f|
				// ab right me hi ja skte h.
				// right me |m| will decrease.
				// right me |f| will decrease.
				// we want smaller m and larger f
				else{
					pm++;
				}
				
			}
		}
		else{
			// both +ve
			if(m>0){
				while(ml[pm]>0){
					pm++;
				}
			}
			// both -ve
			else if(f<0){
				while(fl[pf]<0){
					pf++;
				}
			}
		}
	}
	
	cout << count;
	
	return 0;
}