#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const int mx = 2e5 + 9;

int par[mx];
ll ans;

int find_parent(int x) {
    if (x == par[x]) return x;
    return par[x] = find_parent(par[x]);
}

void join(int u, int v) {
    int p_u = find_parent(u), p_v = find_parent(v);
    if (p_u == p_v) return;

    ans++;
    par[p_u] = p_v;
    return;

}


int main() {
   ll n; cin >> n;

   for (int i = 0; i < mx; i++) {
        par[i] = i;
   }

   ll a[n + 2];
   for(ll i = 0; i < n; i++) {
    cin >> a[i];
   }

   for(ll i = 0; i < n; i++) {
    ll b = a[i];
    ll c = a[n - i - 1];
    join(b, c);

   }

   cout << ans << '\n';

}

#include <bits/stdc++.h>
 
#define ll long long
#define sz(x) ((int) (x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vl vector<long long>
#define pii pair<int, int>
#define REP(i,a) for (int i = 0; i < (a); i++)
#define add push_back
using namespace std;
template<typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
 
const ll MOD = 1000000007LL;
//const ll MOD = 998244353LL;
 
int ni() {
    int x; cin >> x;
    return x;
}
 
ll nl() {
    ll x; cin >> x;
    return x;
}
 
double nd() {
    double x; cin >> x;
    return x;
}
 
string next() {
    string x; cin >> x;
    return x;
}

struct DisjointSetUnion {
    vi parent;
    vi weight;
    int count; //number of components

    DisjointSetUnion(int N) {
        count = N;
        parent.assign(N,0);
        REP(i,N) parent[i] = i;
        weight.assign(N,1);
    }

    //"find"
    int root(int p) {
        if (p==parent[p])
            return p;
        int r = root(parent[p]);
        parent[p] = r;
        return r;
    }

    //"union"
    void connect(int p, int q) {
        p = root(p);
        q = root(q);
        if (p==q) return;

        if (weight[p]<weight[q]) {
            parent[p] = q;
            weight[q] += weight[p];
        } else {
            parent[q] = p;
            weight[p] += weight[q];
        }
        count--;
    }

    bool connected(int p, int q) {
        return root(p)==root(q);
    }
};

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N = ni();
    vi nums(N);
    REP(i,N) {
        nums[i] = ni()-1;
    }

    DisjointSetUnion dsu(200000);
    for (int i = 0; i < N; i++)
        dsu.connect(nums[i],nums[N-1-i]);

    cout << 200000-dsu.count;
}