#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL N=2e5+10;
const int inf=0x7fffffff;
vector<int> adj[N];
vector<int> mst;
LL n,m,k;
int fa[N],arr[N];
int findfa(int x)
{
    if(fa[x]==x)    return fa[x];
    else return fa[x]=findfa(fa[x]);
}
void merge(int x,int y)
{
    int fx=findfa(x),fy=findfa(y);
    if(fx!=fy)
    {
        if(rand()%2)
            fa[fy]=fx;
        else fa[fx]=fy;
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>n;
    for(int i=1;i<=N;i++)   fa[i]=i;
    for(int i=1;i<=n;i++)
    {
        cin>>arr[i];
    }
    bool f=0;
    for(int i=1;i<=n/2+1;i++)
    {
        if(arr[i]!=arr[n-i+1])  f=1;
    }
    if(f==0)    cout<<0<<endl;
    else
    {
        int cnt=0,aa=0;
        set<pair<int,int>> st;
        for(int i=1;i<=n/2;i++)
        {
            if(arr[i]!=arr[n-i+1]&&st.count(make_pair(arr[i],arr[n-i+1]))==0)
            {
                st.insert(make_pair(arr[i],arr[n-i+1]));
                aa++;
                if(findfa(arr[i])==findfa(arr[n-i+1]))  cnt++;
                merge(arr[i],arr[n-i+1]);
            }
        }
        cout<<aa-cnt<<endl;
    }
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
 
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define ALL(c) c.begin(), c.end()
#define TR(c, it) for (auto it = c.begin(); it != c.end(); it++)
#define SZ(c) int(c.size())
#define present(c, e) (c.find(e) != c.end())
#define cpresent(c, e) (find(ALL(c),e) != c.end())
#define ffasstt() ios_base::sync_with_stdio(0); cin.tie(0)
#define ll long long
#define pii(T) pair<T, T>
#define v1(T) vector<T>
#define v2(T) vector< vector<T> >
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
template<class T> void inline Scan(v1(T) &arr){ for(auto &i:arr) cin >> i; }
template<class T> void inline Print(v1(T) &arr){ for(auto &i:arr) cout << fixed << setprecision(7) << i << " "; }

const int N = 200010;

vector<int>adj[N];
v1(bool) vis(N, 0);
ll cnt = 0;
ll ans = 0;
void dfs(int s){
	vis[s] = 1;
	cnt++;
	for(int t: adj[s]){
		if(!vis[t])
			dfs(t);
	}
}
void solve(){
	ll n;
	cin >> n;
	v1(int) arr(n);
	Scan(arr);
	REP(i, 0, n - 1){
		if(arr[i] != arr[n - 1 - i]){
			adj[arr[i]].PB(arr[n - 1 - i]);
			adj[arr[n - 1 - i]].PB(arr[i]);
		}
	}
	REP(i, 0, n - 1){
		if(!vis[arr[i]]){
			cnt = 0;
			dfs(arr[i]);
			ans += (cnt - 1);
		}
	}
	cout << ans;
}
int main()
{
	ffasstt();
	int t = 1;
	// cin >> t;
	while(t--){	
		solve();
	}
	cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC <<" secs"<<endl;
	return 0;
}