#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;
typedef long long int ll;
#define ordered_set tree<ll,null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
void dfs(ll root,map<ll,vector<ll> > &m,map<ll,bool> &vi,set<ll> &s)
{
    s.insert(root);
    for(ll i=0;i<m[root].size();i++)
    {
        if(!vi[m[root][i]])
        {
            vi[m[root][i]]=true;
            dfs(m[root][i],m,vi,s);
        }
    }
    return;
}
void solve()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll i=0,j=n-1;
    map<ll,vector<ll> > m;
    while(i<j)
    {
        if(a[i]!=a[j])
        {
            m[a[i]].push_back(a[j]);
            m[a[j]].push_back(a[i]);
        }
        i++;
        j--;
    }
    map<ll,vector<ll> >::iterator it;
    map<ll,bool> vi;
    ll ans=0;
    for(it=m.begin();it!=m.end();it++)
    {
        ll p=it->first;
        if(!vi[p])
        {
            vi[p]=true;
            set<ll> s;
            dfs(p,m,vi,s);
            ans+=s.size()-1;
        }
    }
    cout<<ans<<endl;
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    ll test_case;
    test_case=1;
    //cin>>test_case;
    while(test_case--)
    {
        solve();
    } 
    return 0;
}
#include<bits/stdc++.h>
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#define all(k) k.begin(),k.end()
#define INF 1e9
#define repk(i,a,n) for(int i=a;i<=n;i++)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define ub pop_back
#define eb emplace_back
#define ll  long long 
#define ull unsigned long long
#define pi pair<int,int>
#define vc vector<char>
#define vpi vector<pi>
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vi>
#define vb vector<bool>
#define pq priority_queue
#define vvc vector<vc>
#define mi map<int,vi>
#define mset map<string,set<char>>
#define umap unordered_map
#define int int64_t
using namespace std;
#define fi first
#define se second
const int mod = int(1e9)+7;
const int N =int(2e5)+5;
int power(int x,int y){  int res=1;  while(y){ if(y&1)res=(res*x)%mod;
    y>>=1;
    x=((x*x)%mod);
  }
return res;
}
int gcd(int x,int y){  if(x==0)    return y; return gcd(y%x,x); }

int pa[N], a[N], b[N];

int fun(int u) 
{
    return (u == pa[u]) ? u : pa[u] = fun(pa[u]);
}

void init(){
    repk(i,1,200000) pa[i] = i;
}
void sol(){
    init();
int n;cin>>n;
vi a(n);
repk(i,1,n/2)
cin>>a[i];
    if(n&1) 
        cin>>b[1];

    per(i,1,n/2) 
        cin>>b[i];
    int ans = 0;
    repk(i,1,n/2)
    {
        int u = fun(a[i]), v = fun(b[i]);
        if(u != v)
        {
            ans++;
            pa[u] = v;
        }
    }

    cout<<ans;
cout<<'\n';
}




int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);

int t=1;
    // cin>>t;


 for(int i=1;i<=t;++i){

 // cout<<"Case #"<<i<<": ";
sol();
}


  return 0;
}
