// Qg3
// //g++ -std=c++17 -O2 -Wall a.cpp -o test
// _()_
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vll vector<ll>
#define vi vector<int>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define vp vector<pi>
#define vpll vector<pll>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
#define For(i,a,b) for(ll i=a;i<b;i++)
//#define endl "\n"
#define debug2(x,y) cout<<"This side ----> "<<#x<<" -> "<<x<<" | "<<#y<<" -> "<<y<<endl;
#define debug(x) cout<<"This side    ----> "<<#x<<" -> "<<x<<endl
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define mint map<int,int>
#define mall map<ll,ll>
#define ciN cin
#define gu(a,s) get<a>(s)
#define tin tuple<ll,ll,ll>
#define ter(x,y,z) ((x)?y:z)
#define ul ll
/////////////
const ll N = 1e6 + 3;
const ll maxn = 2e5 + 5;
const ll max_val = 5e4 + 10;
ll mod = 1e9 + 7;
const ll bits = 20;
ll caseNumber = 1;
////////////////////////////////////////////////////////////////
vi adj[maxn];
vb vis(maxn, 0);
ll cnt = 0;
void dfs(int st) {
	vis[st] = 1;
	cnt++;
	for (auto x : adj[st]) {
		if (!vis[x])dfs(x);
	}
}
void jabru() {
	ll n; cin >> n;
	vll v(n);
	for (int i = 0; i < n; i++)cin >> v[i];

	for (int i = 0; i < n / 2; i++) {
		if (v[i] != v[n - i - 1]) {
			adj[v[i]].pb(v[n - i - 1]);
			adj[v[n - i - 1]].pb(v[i]);
		}
	}
	ll ans = 0;
	for (int i = 1; i < maxn; i++) {
		if (!vis[i]) {
			cnt = 0;
			dfs(i);
			ans += cnt - 1;
		}
	}
	cout << ans << endl;
}
bool TestCase1 = 0;
bool isGoogles = 0;



//////////////////////////////////////////////////////////////////




//////////////////////////////////////////////////////////

int main() {
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	ll t;
	t = 1;



	if (TestCase1) {
		cin >> t;
	}
	while (t--) {
		if (isGoogles) {cout << "Case #" << caseNumber << ": ";} caseNumber++;
		jabru();

	}
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH

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

int N, A[200000], ufds[200000], rnk[200000];
map<int,int> m;

int findSet(int i) {
    return ufds[i] == i ? i : ufds[i] = findSet(ufds[i]);
}

void unionSet(int i, int j) {
    int a = findSet(i), b = findSet(j);
    if (a == b) return;
    if (rnk[a] < rnk[b]) ufds[a] = b;
    if (rnk[a] > rnk[b]) ufds[b] = a;
    if (rnk[a] == rnk[b]) ufds[a] = b, rnk[b]++;
}

int main() {
    scanf("%d", &N);
    for (int i = 0; i < N; ++i) scanf("%d", &A[i]);
    for (int i = 0; i < N; ++i) ufds[i] = i, rnk[i] = 1;
    for (int i = 0; i < N; ++i) {
        if (m[A[i]] != 0) unionSet(i,m[A[i]]-1);
        m[A[i]] = i+1;
    }
    int ans = 0;
    for (int i = 0; i*2 < N; ++i) if (findSet(i) != findSet(N-i-1)) {
        ans++;
        unionSet(i,N-i-1);
    }
    printf("%d", ans);

    return 0;
}
