/*Be patient && calm!
All our dreams can come true, if we have the courage to pursue them.
I fear not the man who has practiced 10,000 kicks once, but I fear the man who has practiced one kick 10,000 times.
Do not pray for an easy life, pray for the strength to endure a difficult one.
When something is important enough, you do it even if the odds are not in your favor.
First, solve the problem. Then, write the code.
Fix the cause, not the symptom.
Simplicity is the soul of efficiency.
Make it work, make it right, make it fast.
No matter how hard it gets, NEVER GIVE UP*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD 1000000007
string longDivision(string number, int divisor)
{
    // As result can be very large store it in string
    string ans;
 
    // Find prefix of number that is larger
    // than divisor.
    int idx = 0;
    int temp = number[idx] - '0';
    while (temp < divisor)
        temp = temp * 10 + (number[++idx] - '0');
 
    // Repeatedly divide divisor with temp. After
    // every division, update temp to include one
    // more digit.
    while (number.size() > idx) {
        // Store result in answer i.e. temp / divisor
        ans += (temp / divisor) + '0';
 
        // Take next digit of number
        temp = (temp % divisor) * 10 + number[++idx] - '0';
    }
 
    // If divisor is greater than number
    if (ans.length() == 0)
        return "0";
 
    // else return ans
    return ans;
}
bool mul200(string n){
	int l=n.length();
	if(l<3){
		// cout<<"r\n";
		return false;
	}
	if(n[l-1]!='0'||n[l-2]!='0'){
		// cout<<"y\n";
		return false;
	}
	if(n[l-3]&1){
		// cout<<"u\n";
		return false;
	}
	return true;

}
void solve(){
	ll n;
	cin>>n;
	ll a[n];
	map<ll,ll> mp;
	ll sum=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=mp[a[i]%200];
		mp[a[i]%200]++;
	}
	cout<<sum<<"\n";
}
int main(){
// 	ios::sync_with_stdio(false);
// 	cout.tie(0);
// 	cin.tie(NULL);
	int t;
	// cin>>t;
	t=1;
    while(t--) {
    	// int n;
    	// cin>>n;
    	solve();
	}
}
#include <iostream>
#include <bits/stdc++.h>

#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define mod 1000000007
#define ll long long
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define PI 3.14159265358979323

using namespace std;



vector<ll>gr[200010];
bool vis[200010]={0};
ll ans=0;


void dfs(ll s){
    vis[s]=0;
    for(auto it:gr[s]) if(vis[it]) dfs(it);
}

int main() {

fio;
int TC=1;
//cin>>TC;
    while(TC--){

        ll n;
        cin>>n;
        ll a[n];

        for(ll i=0;i<n;i++) {
            cin>>a[i];
            if(!vis[a[i]]){
                vis[a[i]]=true;
                ans++;
            }
        }

        for(ll i=0;i<n;i++){
            if(a[i]!=a[n-i-1]){
                gr[a[i]].pb(a[n-i-1]);
                gr[a[n-i-1]].pb(a[i]);
            }
        }

        for(ll i=0;i<200001;i++){
            if(vis[i]){
                dfs(i);
                ans--;
            }
        }

        cout<<ans<<"\n";


    }
return 0;
}