#include <iostream>

using namespace std;



int main()
{
	int N;
	cin >> N;

	int m, bilo = 0;
	int r = -1;
    
    int n, bilo1 = 0;
    int d = -1;
    
	int x[N];
	int y[N];
	
	for (int i = 0; i < N; i++) {
		cin >> m;
		cin >> n;
		bilo = 0;
		bilo1 = 0;
		for (int j = 0; j < r; j++) {
			if (m == x[j]) {
				bilo++;
				//break;
			}
	    }

		if (bilo == 0) {
			r++;
			x[r] = m;
		}
		
		
		for (int k = 0; k < d; k++) {
			if (n == y[k]) {
				bilo1++;
				//break;
			}
	    }

		if (bilo1== 0) {
			d++;
			y[d] = n;
		}
		
		
	}
	
	
	cout << N-r+N-d+1 << endl;


	return 0;

}