#include <bits/stdc++.h> 
using namespace std; 
#define vll vector<long long>
#define mll map<long long,long long>
#define pll pair<long long,long long>
#define pb push_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 998244353 
typedef  long long ll;
typedef long double ld;
long double pi=3.14159265358979323846;

vll al[300005];
ll I[101][101];

ll gcd(ll a,ll b)
{
    if (b==0) return a;
    return gcd(b,a%b);
}

bool isPrime(int n)
{
    if (n<=1) return false; 
    if (n<=3) return true; 
    if (n%2==0||n%3==0) return false; 
    for (int i=5;i*i<=n;i=i+6) if (n%i==0||n%(i+2)==0) return false; 
    return true; 
}

ll bpow(ll n, ll po)
{
	ll res=1;
	while(po>0)
	{
		if(po%2)
		{
			res=(res*n)%mod;
			po--;
		}
		else
		{
			n=(n*n)%mod;
			po/=2;
		}
	}
	return res;
}

void swap(ll *a, ll *b)
{
	ll temp=*a;
	*a=*b;
	*b=temp;
}

ll fact(ll n) { 
   if ((n==0)||(n==1))
      return 1;
   else
      return n*fact(n-1);
}

ll modInverse(ll n,ll p)
{
	return bpow(n,p-2);
}

ll fac[300001];

ll nCr(ll n,ll r) 
{ 
    if (r == 0) return 1; 
    return (fac[n] * modInverse(fac[r], mod) % mod * modInverse(fac[n - r], mod) % mod) % mod; 
} 

//bool bipartite_dfs(ll node, ll flag)
//{
//	vis[node]=1;
//	ll cflag=flag;
//	color[node]=cflag;
//	for(ll child : al[node])
//	{
//		if(!vis[child])
//		{
//			bool n=bipartite_dfs(child,1-cflag);
//			if(n==false) return false;
//		}
//		else if(color[child]==color[node]) return false;
//	}
//	return true;
//}

void mmul(ll A[][101], ll B[][101], ll dim)
{
	ll res[dim][dim];
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		res[i][j]=0;
		for(ll k=0;k<dim;k++) res[i][j]=(res[i][j]+A[i][k]*B[k][j])%1000000007;
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=res[i][j];
}

void mpow(ll A[][101],ll dim, ll po)
{
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++)
	{
		if(i==j) I[i][j]=1;
		else I[i][j]=0;
	}
	while(po>0)
	{
		if(po%2==1)
		{
			mmul(I,A,dim);
			po--;
		}
		else
		{
			mmul(A,A,dim);
			po/=2;
		}
	}
	for(ll i=0;i<dim;i++) for(ll j=0;j<dim;j++) A[i][j]=I[i][j];
}



ll b[200001],vis[200001];

ll dfs(ll node){
	vis[node]=1;
	ll ret=1;
	for(ll i=0;i<al[node].size();i++){
		ll child=al[node][i];
		if(!vis[child]){
			ret+=dfs(child);
		}
	}
	return ret;
}

int main()
{
	FAST
//	freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
	ll testcases=1;
//	cin>>testcases;
//	fac[0]=1;
//	for(ll i=1;i<300001;i++) fac[i]=(fac[i-1]*i)%mod;
	while(testcases--)
	{
		ll n;
		cin>>n;
		ll a[n];
		for(ll i=0;i<n;i++) cin>>a[i];
		for(ll i=0;i<n;i++){
			ll x=a[i],y=a[n-1-i];
			if(x!=y) al[x].pb(y);
		}
		for(ll i=0;i<n;i++) b[a[i]]++;
		ll ans=0;
		for(ll i=1;i<=200000;i++) if(!vis[i]) ans+=dfs(i)-1;
		cout<<ans;
	}
}


// Problem : D - KAIBUNsyo
// Contest : AtCoder - AtCoder Beginner Contest 206（Sponsored by Panasonic）
// URL : https://atcoder.jp/contests/abc206/tasks/abc206_d
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>
using namespace std;
/* DEBUGGING */
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
/* MACROS */ 
typedef long long int ll;
 
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;
 
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

typedef map<int,int> mii;
typedef tuple<int,int,int> tup;

#define  ff          first
#define  ss          second
#define  pb          push_back
#define  IOS         ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  lb          lower_bound
#define  ub          upper_bound
#define  all(x)      (x).begin(), (x).end()
#define  sz(x)       (x).size()
#define  lcm(x, y)   ((x) * (y) / __gcd(x, y))
#define  ps(x,y)     fixed<<setprecision(y)<<x
#define  setbit(x)   __builtin_popcountll(x)
#define  rep(i,a,b)  for(int i=a ; i<b ; ++i)
#define  repr(i,a,b) for(int i=a ; i>=b ; --i)

/* CONSTANTS */ 
#define PI 3.141592653589793
const ll MOD = 1e9 + 7;
const ll INF = 1000000000;
const ll MAX_N = 2e5 + 2;

vi adj[MAX_N],vis(MAX_N);
int sz;

void dfs(int node){
    vis[node] = 1;
    sz++;
    
    for(auto x:adj[node]){
        if(!vis[x]){
            dfs(x);
        }
    }
}

void solve(){
    int n; cin >> n;
    set<int>s;
    fill(all(vis) , 0);
    
    vi v(n);
    rep(i,0,n) cin >> v[i], s.insert(v[i]);
    
    int ans = 0;
    
    rep(i,0,n){
        if(v[i]!=v[n-i-1]){
            adj[v[i]].pb(v[n-i-1]);
            adj[v[n-i-1]].pb(v[i]);
        }
    }
    
    rep(i,1,MAX_N){
        if(!vis[i]){
            sz = 0;
            dfs(i);
            ans+=(sz-1);
        }
    }
    
    cout << min(ans , (int)s.size());
}

int main(){
    IOS;
    solve();
}