#include <iostream>
#include <cmath>
using namespace std;

int main(int argc, char** argv) {
	int n,j,i;
	bool t=true;
	cin>>n;
	int r[n-1],c[n-1];
	for(i=0;i<n;i=i+1){
		cin>>r[i]>>c[i];
	}
	if(n==0 || n==1) {
		cout << "0"<<endl;
		return 0;
	}
	if (n==2){
		if(r[0]!=r[1] && c[0]!=c[1]) cout << "0"<<endl;
		else cout<<"1"<<endl;
		return 0;
	}
	else{
    int x = (n*(n+1));
    x = abs(n-x);
    cout<<x<<endl;
	}
	return 0;
}