#include<cstdio>
#include<algorithm>
#define N 200007
using namespace std;
int n,sum,ans,ma,a[N],fa[N]; 
int find(int x){
	if (fa[x]==x) return x;
	fa[x]=find(fa[x]);
	return fa[x];
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		sum++;
		ma=max(ma,a[i]);
	}
	ans=n;
	for (int i=1;i<=ma;i++)
		fa[i]=i;
	for (int i=1;i<=n/2;i++)
		if (a[i]!=a[n-i+1]){
			int fx=find(a[i]),fy=find(a[n-i+1]);
			if (fx!=fy){
				ans--;
				fa[fy]=fx;
			}
		}
	printf("%d\n",sum-ans);
}
#include <bits/stdc++.h>
#include <chrono>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
/*............................................................................*/ 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
/* find_by_order(x) give iterator of the index x 
   order_by_key(x) give the position where x will be placed*/
#define int long long
#define lop(i,a,b,c) for (int i=a;i<b;i+=c)
#define rlop(i,a,b,c) for (int i=a-1;i>=b;i-=c)
#define prii pair <int,int>
#define PB push_back
#define S second
#define F first
#define all(x) x.begin(),x.end()
#define vvii vector < vector < int > >
#define vii vector <int>
#define count_1(x) __builtin_popcount(x)
#define cn(a) scanf("%lld",&a);
#define cn_vl(arr,n) lop(i,0,n,1){scanf("%lld",arr+i);}
#define shw_vl(arr,n) lop(i,0,n,1){printf("%lld ",arr[i]);}printf("\n");
#define shw(CON) cout << &("NO\0YES"[3 * CON]) << '\n';
const int MAX=2e5+10;
/*......................................................................*/

struct dsu
{
	int parent[MAX];int size[MAX];
	void init(){
		lop (i,1,MAX,1){parent[i]=i;size[i]=1;}
	}
	int trace(int a){
		return (a==parent[a])?a:parent[a]=trace(parent[a]);
	}
	bool connect(int a,int b){
		if ((a=trace(a))==(b=trace(b)))return false;
		if (size[b]>size[a])swap(a,b);
		parent[b]=a;size[a]+=size[b];
		return true;
	}
}ori;
vii adj[MAX];
void solve(){
	int n;cn(n)
	vii vec;ori.init();
	lop (i,0,n,1){
		int a;cn(a)
		vec.PB(a);adj[a].PB(i);ori.connect(adj[a].front(),i);
	}
	
	int cst=0;
	lop (i,0,n/2,1){
		if (ori.trace(i)!=ori.trace(n-1-i)){
			cst++;ori.connect(i,n-1-i);
		}
	}
	cout<<cst;
}
int32_t main(){
	int t;t=1;
	// cin>>t;
	while (t--){
		auto t_1=chrono::high_resolution_clock::now();
		solve();
		auto t_2=chrono::high_resolution_clock::now();
		// cout <<". Elapsed (ms): " << chrono::duration_cast<chrono::milliseconds>(t_2 - t_1).count() << endl;
	}
	return 0;
}