#include<algorithm>
#include<cmath>
#include<cstring>
#include<iostream>
#include<cstdio>
#include<set>
using namespace std;
const int maxn=1e3;
int main()
{
    int n,a[maxn],b[maxn];
    cin>>n;;
        int sum=0,x,y;
        set<int>s1,s2;
        for(int i=1;i<=n/2;i++){
            cin>>x>>y;
                s1.insert(x);
                s2.insert(y);
            if(a==b)
                sum++;
        }
        cout<<(s1.size()-1+s2.size()-1+sum)<<endl;
    return 0;
}