#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,i;
    int t=n/2;
    for(i=0;i<t;i++) {
        cin >> a[i] >> b[i];
        if (a[i] == b[i])
            sum++;
    }
    set<int>s1(a,a+i),s2(b,b+i);
        cout<<(s1.size()-1+s2.size()-1+sum)<<endl;
    return 0;
}