#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<ll>>;
struct UnionFind{
  vector<ll> par,siz;
  UnionFind(int n):par(n,-1),siz(n,1){}

  ll root(int x){
    if(par[x]==-1) return x;
    else return par[x]= root(par[x]);
  }

  bool issame(int x,int y){
    return root(x)==root(y);
  }

  bool unite(ll x,ll y){
    x=root(x);
    y=root(y);
    if(x==y) return false;
    if(siz[x]<siz[y]) swap(x,y);
    par[y]=x;
    siz[x]+=siz[y];
    return true;
  }
  ll size(int x){
    return siz[root(x)];
  }
};


int main(){
  ll N;
  cin >> N;
  vector<ll>A(N);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  UnionFind uf(201010);
  for(int i=0;i<N/2;i++){
    uf.unite(A[i],A[N-i-1]);
  }
  int ans=0;
  for(int i=0;i<201010;i++){
    if(uf.root(i)==i) ans+= uf.size(i)-1;
  }
  cout << ans;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

struct union_find {
    vector<int> par, siz;
    union_find(int n) {
        par.resize(n);
        siz.resize(n);
        for(int i = 0; i < n; i++){
            par[i] = i;
            siz[i] = 1;
        }
    }
    
    int find(int x) {
        if (par[x] == x) return x;
        return par[x] = find(par[x]);
    }
 
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y)return;
        if (siz[x] < siz[y]) {
            par[x] = y;
            siz[y] += siz[x];
        }
        else {
            par[y] = x;
            siz[x] += siz[y];
        }
    }
    
    long long size(int x){
        return siz[find(x)];
    }

    bool same(int x, int y) {
        return (find(x) == find(y));
    }
};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    ll n; cin >> n;
    ll a[n]; zep(i, 0, n)cin >> a[i];

    union_find u(2e5 + 100);
    ll ans = 0;
    zep(i, 0, n / 2){
        if(!u.same(a[i], a[n - 1 - i])){
            ans++;
            u.unite(a[i], a[n - 1 - i]);
        }
    }
    print(ans)
    
    return 0;
}