#include <bits/stdc++.h>
/*#include <iostream>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <sstream>*/

#define ll long long
#define fop(i,m,n) for(int i=m; i<n; i++)
#define fastIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define X first
#define Y second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()

using namespace std;

const long long MOD = 1e9+7;
const long long N = 2e5+5;
const long long Nlog = 17;
const long long Hash = 257;

const double PI = 2.0*acos(0.0);//<cmath>
//const double PI = 3.141592653;
const double E = 2.718281828;

struct DSU{
    int p[N+1];
    void init(int n){
        fop(i,1,n+1) p[i] = i;
    }
    int Find(int x){
        if(x == p[x]) return x;
        else{
            p[x] = Find(p[x]);
            return p[x];
        }
    }
    void Union(int x, int y){
        p[Find(x)] = Find(y);
    }
}dsu;

void solve(){
    
    int n;
    cin >> n;
    int a[n];
    fop(i,0,n) cin >> a[i];
    
    dsu.init(N);
    int ans = 0;
    fop(i,0,n/2){
        if(a[i] != a[n-1-i]){
            if(dsu.Find(a[i]) != dsu.Find(a[n-1-i])){
                ans++;
                dsu.Union(a[i], a[n-1-i]);
            }
            
        }
    }
    
    cout << ans << '\n';
    
}


int main()
{
    fastIO;

    int t=1;
    //cin >> t;
    while(t--) solve();

    return 0;
}
#include <bits/stdc++.h>
#define ll long long

#define t     \
    ll t;     \
    cin >> t; \
    while (t--)
#define ln "\n"

#define fst                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define F(i, L, R) for (int i = L; i < R; i++)

#define FE(i, L, R) for (int i = L; i <= R; i++)

#define FF(i, L, R) for (int i = L; i > R; i--)

#define FFE(i, L, R) for (int i = L; i >= R; i--)

#define mod 1000000007

#define DBG(vari) cerr << #vari << " = " << (vari) << endl

using namespace std;
vector<int>v[200001];
bool vis[200001];
int ans=0;
void dfs(int node)
{
    vis[node]=1;
    ans++;
    for(auto child:v[node])
    {
        if(vis[child]==0&&v[child].size()!=0)
        {
            dfs(child);
        }
    }

}
void solve()
{
    ll n;
    cin>>n;
    int arr[n+3];
    F(i,0,n)cin>>arr[i];

    int i=0,j=n-1;
    while(i<j)
    {
        if(arr[i]!=arr[j])
        {
            v[arr[i]].push_back(arr[j]);
            v[arr[j]].push_back(arr[i]);
        }
        i++;
        j--;
    }
    for(int k=0; k<n; k++)
    {
        if(v[arr[k]].size()!=0&&vis[arr[k]]==0)
        {
            dfs(arr[k]);
            ans--;
        }
    }
    cout<<ans<<ln;

}

int main()
{
    fst


    solve();
}
