#include<iostream>
#include<cstdio>
#include<cassert>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<vector> 
#include<cstring>
#include<string>
#include<map>
#include<set>

#define mp make_pair
#define scn second
#define frs first
#define pb push_back

#define NAME "hobby"

using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, int> pi;
const int P = 239017;
const ll INF = 10000000000000000ll;

int n, k;

int main(){
    freopen(NAME ".in", "r", stdin); 
    freopen(NAME ".out", "w", stdout); 
	scanf("%d", &n);
	vector<pair<pi, int> > pts;
	for (int i = 0; i < n; ++i) {
		int x, y;
		scanf("%d%d", &x, &y);
		pts.pb(mp(mp(x, y), i + 1));
	}
	printf("%d\n", n / 2);
	for (int i = 0; i + 1 < pts.size(); i += 2) {
		printf("%d %d\n", pts[i].scn, pts[i + 1].scn); 
	}
	
	return 0;
}




