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

const ll p = 1000000009;
const ll nax = 200002;

int par[nax];

int pr(int v) {
	if (par[v] == v) return v;
	return par[v] = pr(par[v]);
}

int main() {

	for (int i = 0; i < nax; ++i) {
		par[i] = i;
	}
	int n;
	cin >> n;
	vector<int> v(n);
	for (auto& x : v) cin >> x;

	int ans = 0;	

	for (int i = 0; i < n; ++i) {
		int a = pr(v[i]), b = pr(v[n - 1 - i]);
		if (a == b) continue;
		ans++;
		par[a] = b;
	}
	cout << ans;
}
#ifdef MYDEBUG
#include "pch.h"
#else
#include <bits/stdc++.h>
#define debug(...) 
#endif
using namespace std;

#define int long long
#define endl '\n'

#define sz(x) (int)((x).size())
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()

typedef vector<int> vi;
typedef map<int, int> mii;
typedef pair<int, int> pii;

template<typename T1, typename T2>istream& operator>>(istream& in, pair<T1, T2>& a) { return in >> a.first >> a.second; }
template<typename T1, typename T2>ostream& operator<<(ostream& out, pair<T1, T2> a) { return out << a.first << " " << a.second;}

template<typename T>void print(T t) { cout << t; }
template<typename T, typename... Args>void print(T t, Args... args) { cout << t << " "; print(args...); }
template<typename... Args>void printl(Args... args) { print(args...); cout << endl; }
template<typename T>void printa(T& a, bool ln = 0) { for (auto& e : a) print(e, ln?"\n":""); if (!ln) cout << endl; }

#define printr(...) { printl(__VA_ARGS__); return; }
#define inputa(a) for (auto& e : a) cin >> e

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int RAND(int lo = 0, int hi = LLONG_MAX) { return uniform_int_distribution<int>(lo, hi)(rng); }

void google() { static int __gtest__ = 1; cout << "Case #" << __gtest__++ << ": "; }

const double pi = 3.141592653589793;

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	cout << setprecision(15) << fixed;
	int t = 1;
	//cin >> t;
	void code();
	while (t--) code();
}

const int mod = 1e9 + 7;
const int mod1 = 998244353;
const int maxn = 2e5 + 1;

vi ar[maxn];
bool vis[maxn];

int dfs(int nd)
{
	vis[nd] = 1;
	int cc = 0;
	for (auto& ch : ar[nd])
	{
		if (vis[ch]) continue;
		cc += dfs(ch);
	}
	return cc + 1;
}

void  code()
{
	int n;
	cin >> n;
	vi a(n);
	inputa(a);

	for (size_t i = 0; i < n/2; i++)
	{
		if (a[i] == a[n - 1 - i]) continue;
		ar[a[i]].push_back(a[n - 1 - i]);
		ar[a[n - 1 - i]].push_back(a[i]);
	}

	int cc = 0;
	for (size_t i = 1; i < maxn; i++)
	{
		if (vis[i]) continue;
		cc += dfs(i) - 1;
	}

	printl(cc);
}