#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int n;
int s[200005];
vector<int>v[200005];
int ans=0;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>s[i];
		v[s[i]].push_back(i);
	}
	for(int i=1;i<=n/2;++i)
	{
		if(s[i]!=s[n+1-i])
		{
			int x=s[i],y=s[n+1-i];
			++ans;
			if(v[x].size()<=v[y].size())
			{
				for(int j=0;j<v[x].size();++j)
				{
					int z=v[x][j];
					s[z]=s[n+1-i];
					v[y].push_back(z);
				}
			}
			else
			{
				for(int j=0;j<v[y].size();++j)
				{
					int z=v[y][j];
					s[z]=s[i];
					v[x].push_back(z);
				}
			}
			
		}
	}
	cout<<ans;
	return 0;
}
#include <bits/stdc++.h>
 
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define REP(i,a) for (int i = 0; i < (a); i++)
#define add push_back
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
 
const ll MOD = 1000000007LL;
//const ll MOD = 998244353LL;
 
int ni() {
    int x; cin >> x;
    return x;
}
 
ll nl() {
    ll x; cin >> x;
    return x;
}
 
double nd() {
    double x; cin >> x;
    return x;
}
 
string next() {
    string x; cin >> x;
    return x;
}

struct DisjointSetUnion {
    vi parent;
    vi weight;
    int count; //number of components

    DisjointSetUnion(int N) {
        count = N;
        parent.assign(N,0);
        REP(i,N) parent[i] = i;
        weight.assign(N,1);
    }

    //"find"
    int root(int p) {
        if (p==parent[p])
            return p;
        int r = root(parent[p]);
        parent[p] = r;
        return r;
    }

    //"union"
    void connect(int p, int q) {
        p = root(p);
        q = root(q);
        if (p==q) return;

        if (weight[p]<weight[q]) {
            parent[p] = q;
            weight[q] += weight[p];
        } else {
            parent[q] = p;
            weight[p] += weight[q];
        }
        count--;
    }

    bool connected(int p, int q) {
        return root(p)==root(q);
    }
};

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N = ni();
    vi nums(N);
    REP(i,N) {
        nums[i] = ni()-1;
    }

    DisjointSetUnion dsu(200000);
    for (int i = 0; i < N; i++)
        dsu.connect(nums[i],nums[N-1-i]);

    cout << 200000-dsu.count;
}