// EXPLOSION!
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include<chrono>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<ll, ll>> vpll;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define mp make_pair
#define rsz resize
#define sz(x) int(x.size())
#define all(x) x.begin(),x.end()
#define f first
#define s second
#define cont continue
#define endl '\n'
//#define ednl '\n'
#define test int testc;cin>>testc;while(testc--)
#define pr(a, b) trav(x,a)cerr << x << b; cerr << endl;
#define message cout << "Hello World" << endl;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 }; // for every grid problem!!
const ll linf = 4000000000000000000LL;
const ll inf = 1000000007;//998244353    

void pv(vi a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vll a) { trav(x, a)cout << x << " "; cout << endl; }void pv(vector<vi>a) {
	F0R(i, sz(a)) { cout << i << endl; pv(a[i]); cout << endl; }
}void pv(vector<vll>a) { F0R(i, sz(a)) { cout << i << endl; pv(a[i]); }cout << endl; }void pv(vector<string>a) { trav(x, a)cout << x << endl; cout << endl; }
void setIO(string s) {
	ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef arwaeystoamneg
	if (sz(s))
	{
		freopen((s + ".in").c_str(), "r", stdin);
		if (s != "test1")
			freopen((s + ".out").c_str(), "w", stdout);
	}
#endif
}
int n, m, cur = 0, co = 0;
const int MAX = 2e5 + 5;
vector<vi>adj;
vi a, v;
void dfs(int i)
{
	v[i] = 1;
	trav(x, adj[i])
	{
		if (!v[x])dfs(x);
	}
}
int main()
{
	setIO("test1");
	cin >> n;
	a.rsz(n);
	trav(x, a)cin >> x, x--;
	adj.rsz(MAX);
	F0R(i, n / 2)
	{
		adj[a[i]].pb(a[n - i - 1]);
		adj[a[n - i - 1]].pb(a[i]);
	}
	v.rsz(MAX);
	F0R(i, MAX)
	{
		if (v[i])continue;
		dfs(i);
		co++;
	}
	cout << MAX - co << endl;
}
#pragma GCC optimize("Ofast")
#pragma GCC optimization ("unroll-loops")
 
#include <bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ff first
#define ss second
#define ins insert
#define sz(x) (int)x.size()
#define dbg(x) cout << x << "\n";
 
const int N = 2e5 + 5;
const long long int mod = 1e9 + 7;
const long long int Mod = 998244353;
const long double Pi = acos(-1);
const long long int Inf = 4e18;
const long double Eps = 1e-9;
 
int dx[9] = {0, 1, -1, 0, 0, 1, 1, -1, -1};
int dy[9] = {0, 0, 0, 1, -1, 1, -1, 1, -1};
 
using namespace std;

#define int long long int

struct DSU{
        vector <int> arr, s, g[200005];

        void Initialize(){
                s.assign(N, 1);
                for(int i = 0; i<N; i++){
                        g[i].pb(i);
                        arr.pb(i);
                }
        }

        int Root (int x){ return arr[x]; }

        void Merge (int x, int y){
                x = Root(x);
                y = Root(y);
                if(x != y){
                        if(s[x] < s[y]){
                                for(auto u: g[x]){
                                        g[y].pb(u);
                                        arr[u] = y;
                                }
                                s[y] += s[x];
                        }
                        else{
                                for(auto u: g[y]){
                                        g[x].pb(u);
                                        arr[u] = x;
                                }
                                s[x] += s[y];         
                        }
                }
        }

        bool Find (int a, int b){
                if(Root(a) == Root(b)) return true;
                else return false;
        }
};
 
void TestCase (){
        int n, ans = 0;
        cin >> n;

        DSU dsu;
        dsu.Initialize();

        vector <int> a(n + 1);

        for(int i = 1; i<=n; i++) cin >> a[i];

        for(int i = 1; i<=n; i++){
                if(dsu.Find(a[i], a[n + 1 - i]) == false){
                        dsu.Merge(a[i], a[n + 1 - i]);
                }
        }

        set <int> roots;
        for(int i = 1; i<N; i++) roots.ins(dsu.arr[i]);

        for(auto &o: roots) ans += dsu.s[o] - 1;

        cout << ans;
        
}

#undef int
 
int main(){
        IOS;
        int T = 1;
        // cin >> T;
        while(T--){
                TestCase();
                cout << "\n";
        }
        return 0;
}