#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define mod 1000000007

ll fa[200005];
ll p[200005];

ll gf(ll v){
	if(fa[v]==v){
		return v;
	}
	fa[v]=gf(fa[v]);
	return fa[v];
}
void merge(ll i,ll j){
	i=gf(i);
	j=gf(j);
	if(i!=j){
		fa[j]=i;
	}
}

int main()
{
	ll t,n,i,j;
	cin>>n;
	for(i=1;i<=n;i++)
	{
		scanf("%lld",&p[i]);
	}
	for(i=1;i<=200005;i++)
	{
		fa[i]=i;
	}
	ll ans=0;
	for(i=1;i<=n;i++)
	{
		j=n+1-i;
		if(gf(p[i])==gf(p[j])) continue;
		ans++;
		merge(p[i],p[j]);
//		for(ll ii=1;ii<=n;ii++) cout<<fa[ii]<<" ";cout<<endl;
	}
	cout<<ans;
	
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template<typename T>
void view_1d(vector<T> V, string sep) {
    for (ll i=0; i<V.size(); i++) {
        cout << V[i];
        if (i == V.size() - 1) {
            cout << endl;
        } else {
            cout << sep;
        }
    }
}

template<typename T>
void view_2d(vector<vector<T>> V, string sep) {
    for (ll i=0; i<V.size(); i++) {
        for (ll j=0; j<V[i].size(); j++) {
            cout << V[i][j];
            if (j == V[i].size() - 1) {
                cout << endl;
            } else {
                cout << sep;
            }
        }
    }
}

//==============================//

vector<vector<int>> graph;
vector<int> seen;

void dfs(int v, int tmp) {
    seen[v] = tmp;
    for (auto next_v : graph[v]) {
        if (seen[next_v] != -1) continue;
        dfs(next_v, tmp);
    }
}

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (int i=0; i<N; i++) cin >> A[i];

    int maxA = *max_element(A.begin(), A.end());
    graph.resize(maxA);

    for (int i=0; i<N/2; i++) {
        if (A[i] != A[N-1-i]) {
            graph[A[i]-1].push_back(A[N-1-i]-1);
            graph[A[N-1-i]-1].push_back(A[i]-1);
        }
    }

    seen.assign(maxA, -1);
    int cnt = 0;

    for (int v=0; v<maxA; v++){
        if (seen[v] != -1 || graph[v].empty()) continue;
        dfs(v, cnt);
        cnt++;
    }

    int ans = 0;
    if (cnt == 0) {
        ans = 0;
    } else {
        unordered_map<int,int> mp;
        for (int j=0; j<maxA; j++) {
            if (seen[j] != -1) mp[seen[j]]++;
        }
        for (auto x : mp) {
            ans += x.second - 1;
        }
    }

    cout << ans << endl;
}
