#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstring>
#define fi              first
#define se              second
#define mp              make_pair
#define all(x)          x.begin(), x.end()
#define For(it, x, y)	for(int it = x; it < y; it ++)
#define ios             ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define bug(str, x)     cerr << "# " << str << " : " << x << '\n'
#define here(x)         cerr << "here " << x << '\n'

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 2e5 + 10;
const int maxa = 2e5;
const int inf = 1e9;
int a[maxn];
bool visited[maxn];
vector<int> G[maxn];

void dfs(int v){
	visited[v] = true;
	for(int u : G[v]){
		if(!visited[u]){
			dfs(u);
		}
	}
}

int main(){
	ios;
	int n;
	cin >> n;
	For(i, 0, n){
		cin >> a[i];
	}
	For(i, 0, n / 2){
		G[a[i]].push_back(a[n - 1 - i]);
		G[a[n - 1 - i]].push_back(a[i]);
	}
	int cnt = 0;
	For(i, 1, maxa + 1){
		if(!visited[i]){
			dfs(i);
			cnt ++;
		}
	}
	cout << maxa - cnt;
}

#include <bits/stdc++.h>
#define f first
#define s second
#define all(vec) begin(vec), end(vec)
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mk make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<double, int> pdi;

const int N = 2e5+3;
vector<int> adj[N];
vector<bool> vis(N);
int cnt;
void dfs(int c){
    vis[c] = 1;
    cnt++;
    for(auto& i : adj[c]){
        if(!vis[i]){
            dfs(i);
        }
    }
}
void solve(){
    int n, ans = 0;
    cin >> n;
    vector<int> a(n+1);
    for(int i = 1; i <= n; i++)cin >> a[i];
    for(int i = 1; i <= n; i++){
//        if(a[i] == a[n-i+1])continue;
        adj[a[i]].pb(a[n-i+1]);
        adj[a[n-i+1]].pb(a[i]);
    }
    for(int i = 1; i < N; i++){
        if(!vis[i]){
            cnt = 0;
            dfs(i);
            ans += cnt-1;
        }
    }
    cout << ans << '\n';
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen("input.in", "r", stdin);
//    freopen("input.in", "w", stdout);
    int tc = 1;
//    cin >> tc;
    while(tc--)solve();
}
