#include <bits/stdc++.h>
#define dbg(args...){ string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define fastio() ios_base::sync_with_stdio(false); cin.tie(nullptr) 
#define pb push_back
#define ff first
#define ss second

using namespace std;
using ll = long long;

void err(istream_iterator<string> ) {cerr << "NEXT\n"; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << ", ";
	err(++it, args...);
}

const int MOD = 1e9 + 7, MOD1 = (119 << 23) | 1;
const int INF = 1e9 + 5, MAX = 2e5 + 5;

int fat[MAX], siz[MAX], ans = 0;

int get(int x) {
	return ((fat[x] == x)? x : fat[fat[x]] = get(fat[x]));
}

void join(int x, int y) {
	x = get(x);
	y = get(y);

	if (x == y) return;

	++ans;
	if (siz[x] < siz[y]) swap(x, y);

	siz[x] += siz[y];
	fat[y] = x;
}

void run_case() { // don't forget to reset global variables at the end of each test case
	int n;
	cin >> n;
	vector<int> arr(n);
	for (int &x : arr) {
		cin >> x;
		fat[x] = x;
	}

	for (int i = 0; 2 * i < n; ++i) {
		join(arr[i], arr[n - i - 1]);
	}
	cout << ans << "\n";
}

int main() {
	fastio();

	int tests = 1;
	//cin >> tests;
	while (tests--) {
		run_case();
	}
	
	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
*/

/* Let n be the main variable in the problem.

	If n ≤ 12, the time complexity can be O(n!).
	If n ≤ 25, the time complexity can be O(2^n).
	If n ≤ 100, the time complexity can be O(n^4).
	If n ≤ 500, the time complexity can be O(n^3).
	If n ≤ 10^4, the time complexity can be O(n^2).
	If n ≤ 10^6, the time complexity can be O(n log n).
	If n ≤ 10^8, the time complexity can be O(n).
	If n > 10^8, the time complexity can be O(log n) or O(1).
*/

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

#define Kshitiz  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
#define deb(x) cout << #x << " is :" << x << "\n";
#define print(x) cout << x << "\n";
#define int long long
#define forf(i,k,n) for (int i = k; i < n; i++)
#define forb(i,n, k) for (int i = n - 1; i >= k; i--)
#define seti set<int>
#define useti unordered_set<int>
#define mapii map<int, int>
#define umapii unordered_map<int, int>
#define vpi vector <pair<int , int> >
#define vi vector<int>
#define pi pair<int , int >
#define vvi vector<vector<int>>
#define pb push_back 
#define sz size()
#define forall(var) var.begin(), var.end()
#define present(c, x) (c.find(x) != c.end())
#define desc greater<int>()
#define spc <<" "<<
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define minus1 cout << "-1\n";
#define ndl cout << "\n";
#define gcd(a, b) __gcd(a, b)
#define PI 3.1415926535897932384626
#define imin INT_MIN
#define imax INT_MAX
#define fi first
#define se second
#define set_bits(x) __builtin_popcountint(x)

const int MN=4e5+1;
int M = 1e9 + 7;

int mod(int n) { return (n % M + M) % M; }
int modM(int n, int m) { return ((n % M * m % M) + M) % M; }
int modA(int n, int m) { return ((n % M + m % M) + M) % M; }
int modS(int n, int m) { return ((n % M - m % M) + M) % M; }
int power(int a , int n);
int mInv(int a){ return power(a , M-2); }


//========================XINYSTER=================================//
vector<int> adj[MN];
bool vis[MN] ;

int dfs( int v  ){
    vis[v]=1;
    //cout<<v<<"->";
    int n =1 ;
    for( auto child : adj[v]){
        if( vis[child]==0)
            n+=dfs( child );
    }
    return n;
}
void solve (){
    int n ; cin >> n ;

    int arr[n] ;

    for(int i=0 ;i<n ;i++){
        cin >> arr [i ];
    }
    for( int i=0 ;i<n/2; i++){
        int a = arr[i] , b= arr[n-i-1];

        adj[a].push_back(b) , adj[b].push_back(a);  
    }

int ct=0;


for( int i=0; i<n; i++){
    if( vis[arr[i]]!=1){
        
        int k = dfs(arr[i] );
        //deb(k)
        ct += k-1 ;
    }
}
    cout << ct ;
}

int32_t main(){

    Kshitiz
    
    int t = 1;
    //cin >> t;

    for(int i=1; i<=t; i++){
        //cout<<"Case #"<<i<<" :\n";
        solve();
    }
    return 0 ;
}






//===================================================================//

int power(int a , int n){
    int result = 1;
    while(n){
        if(n & 1) result = (result * a) % M;
        n >>= 1;
        a = (a * a) % M;
    }
    return result;
}



