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

typedef long long ll;
typedef long double ld;
const ll mod = 1e9 + 7;

ll ans = 0;
ll get(map<ll, ll> &parent, ll a)
{
    return parent[a] = (parent[a] == a) ? a : get(parent, parent[a]);
}

void merge(map<ll, ll> &parent, map<ll, ll> &rank, ll a, ll b)
{
    a = get(parent, a);
    b = get(parent, b);

    if (a != b)
        ans++;

    if (rank[a] == rank[b])
        rank[a]++;
    if (rank[a] > rank[b])
        parent[b] = a;
    else
        parent[a] = b;
}

void solve()
{
    ll n;
    cin >> n;
    map<ll, ll> parent;
    map<ll, ll> rank;
    vector<ll> a(n);
    for (ll &i : a)
    {
        cin >> i;
        parent[i] = i;
        rank[i] = 1;
    }
    for (ll i = 0; i < n / 2; ++i)
    {
        merge(parent, rank, a[i], a[n - i - 1]);
    }
    cout << ans << endl;
}

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

    //   ll t;
    //   cin >> t;
    //   while (t--)
    //   {
    cout << setprecision(15) << fixed;
    solve();
    //   }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pii pair <int,int>
#define pll pair <ll,ll>
#define testcase() int t; cin>>t; while(t--)
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define vll vector <ll>
#define vi vector <int>
#define all(v) v.begin(),v.end()

ll M = 1e9 + 7;
double pi = acos(-1.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll powerm(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x)%M; y=y>>1; x=(x*x)%M;} return res%M; }
ll power(ll x,ll y){ ll res=1; while(y){ if(y&1) res=(res*x); y=y>>1; x=(x*x);} return res; }
ll gcd(ll a,ll b){if(b>a)return gcd(b,a); if(b==0)return a; return gcd(b,a%b);}

const int N = 2e5 + 5;
vi adj[N];
vector <bool> vis(N,false);
int cc = 0;

void dfs(int u,int par=-1)
{
    vis[u] = true;
    cc++;
    for(auto it:adj[u])
    {
        if( it == par || vis[it] ) continue;
        dfs(it,u);
    }
    
}


int main() {
	
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	int n; cin >> n;
    vi a(n);
    forn(i,n) cin >> a[i];
    set <pii> s;
    set <int> kk;
    for(int i=0;i<n/2;i++)
    {
        if( a[i] == a[n-i-1] ) continue;
        pii p = {a[i],a[n-i-1]};
        if( p.ff > p.ss ) swap(p.ff,p.ss);
        if( !s.count(p) )
        {
            adj[a[i]].pb(a[n-i-1]);
            adj[a[n-i-1]].pb(a[i]);
            kk.insert(a[i]);
            kk.insert(a[n-i-1]);
        }        
    }


    int ans = 0;
    for(auto it:kk)
    {
        if( vis[it] ) continue;
        cc = 0;
        dfs(it);
        ans += (cc - 1);
    }
    cout << ans << endl;
    

	return 0;
}
