#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define lli long long int
#define tc int t;cin>>t;while(t--)
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define pb push_back
#define pi pair<int,int>
#define pll pair<lli,lli>
#define vi vector<int>
#define vll vector<lli>
#define vpi vector<pair<int,int> > 
#define vpll vector<pair<lli,lli> > 
#define vvi vector<vector<int> >
#define vvll vector<vector<lli> >
#define vvpi vector<vector<pair<int,int> > >
#define vvpll vector<vector<pair<lli,lli> > >
#define inf 1000000000
#define maxn 200005
lli mod=998244353;


vi par(maxn),sz(maxn);
 
int rep(int v) {
    if (v == par[v])
        return v;
    return par[v] = rep(par[v]);
}
 
void unite(int a, int b) {
    a = rep(a);
    b = rep(b);
    if (a != b) {
        if (sz[a] < sz[b])
            swap(a, b);
        par[b] = a;
        sz[a] += sz[b];
    }
}

void pre(int n){
    for(int i=0;i<n;i++){
        par[i]=i;
        sz[i]=0;
    }
}

int main(){
    fastio;
    int n;
    cin>>n;
    vll a(n);
    pre(maxn);
    map<pair<lli,lli> ,lli > mp;
    lli ans=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n/2;i++){
        if(a[i]!=a[n-1-i]){
            mp[{min(a[i],a[n-1-i]),max(a[i],a[n-1-i])}]++;
        }
    }
    for(auto it : mp){
        if(rep(it.f.f)!=rep(it.f.s)){
            ans++;
            unite(it.f.f,it.f.s);
        }
    }
    cout<<ans<<"\n";
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define pqueue priority_queue
#define umap unordered_map
#define uset unordered_set
#define bits(x) __builtin_popcount((x))
#define gcd(x, y) __gcd(x, y)
#define lcm(x, y) ((x) / gcd(x, y) * (y))
#define inf 4557430888798830399LL
#define mst(dp, val) memset(dp, val, sizeof(dp))
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repd(i, a, b, d) for (int i = a; i <= b; i += d)
#define rep_(i, a, b) for (int i = a; i >= b; --i)
#define repd_(i, a, b) for (int i = a; i >= b; i -= d)
#define mxm(a, b) a = max(a, b) 
#define mnm(a, b) a = min(a, b)
#define pb push_back
#define X first
#define Y second
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << #x << "=" << x << endl
#define readArr(a, n) for (int i = 1; i <= n; i++) cin >> a[i];
#define printArr(a, n) for (int i = 1; i <= n; i++) cout << a[i] << " "; cout << endl;
#define mod 1000000007
#define Add(x, d) x = (x + (d)) % mod
#define print(e) cout << (e) << endl
// #define MULTI_CASES
// #define PRE
const int N = 2e5 + 5;
int a[N];
int f[N], sz[N];

int find(int x) {
    return x == f[x] ? x : f[x] = find(f[x]);
}

void join(int x, int y) {
    int fx = find(x), fy = find(y);
    if (fx != fy) {
        f[fx] = fy;
        sz[fy] += sz[fx];
    }
}

void solve() {
    int n; cin >> n;
    readArr(a, n);
    rep(i, 1, N - 1) {
        f[i] = i;
        sz[i] = 1;
    }
    for (int i = 1, j = n; i < j; i++, j--) {
        if (a[i] != a[j]) join(a[i], a[j]);
    }

    int res = 0;
    int cnt = 0;
    rep(i, 1, N - 1) {
        if (find(i) == i) cnt += sz[i], res += sz[i] - 1;
    }
    print(res);
}

void solve5() {
    int l, r;
    cin >> l >> r;

    //[1~lim]区间有多少个数具有因子f
    auto cal = [&](int f, int lim, int y) {
        int cnt = 0;
        repd(x, f, lim, f) {
            if (gcd(x, y) != x) cnt++; 
        }
        return cnt;
    };

    int res = 0;
    rep(y, l, r) {
        //枚举y的因子
        for (int f = 2; f * f <= y; f++) {
            if (y % f) continue;
            res += cal(f, y - 1, y) - cal(f, l-1, y);
            if (y / f != f)
            res += cal(y / f, y - 1, y) - cal(y / f, l-1, y);
        }
    }
    print(2*res);
}




signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    #ifdef MULTI_CASES
        #ifdef PRE
            pre();
        #endif
        int t; cin >> t;
        while (t--) solve();
    #else
        solve();
    #endif
    return 0;
}


