#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <queue>
#include <fstream>
#include <stdio.h>
#include <bitset>
#include <set>
#include <iomanip>
#include <random>
#include <iterator>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long unll;
#define fi first
#define se second

void dfs(int v, vector<vector<int>>& adj, vector<bool>& used)
{
    used[v] = 1;
    for (int i = 0; i < adj[v].size(); ++i)
    {
        if (used[adj[v][i]]) continue;
        dfs(adj[v][i], adj, used);
    }
}

void solve()
{
    int n, res = 0;
    cin >> n;
    vector<int> a(n);
    for (auto& i : a) cin >> i;
    vector<vector<int>> adj(200000);
    for (int i = 0; i < n; ++i)
    {
        adj[a[i] - 1].push_back(a[n - 1 - i] - 1);
    }
    vector<bool> used(200000, 0);
    for (int i = 0; i < n; ++i)
    {
        if (used[a[i] - 1]) continue;
        dfs(a[i] - 1, adj, used);
        --res;
    }
    sort(a.begin(), a.end());
    for (int i = 1; i < n; ++i) if (a[i - 1] != a[i]) ++res;
    ++res;
    cout << res;

}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

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

typedef long long ll;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cerr << '\n'; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << " "; err(++it, args...); }

#define        optimize           ios::sync_with_stdio(0); cin.tie(0);
#define PI    acos(-1.0)
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define RESET(a, b) memset(a, b, sizeof(a))
#define pii pair <int, int>
#define min3(a, b, c) min(c, min(a, b))
#define max3(a, b, c) max(c, max(a, b))

const ll MX = 2e5 + 105;

vector <int> adj[MX];
int ara[MX];
bool vis[MX];
int c = 0;

void dfs(int u)
{
    c++;
    vis[u] = 1;
    for(auto v: adj[u]){
        if(!vis[v]){
            vis[v] = 1;
            dfs(v);
        }
    }
}

int main()
{
    optimize
    int n;
    cin>>n;

    for(int i = 0; i < n; i++){
        cin>>ara[i];
    }
    for(int i = 0; i < n/2; i++){
        adj[ara[i]].push_back(ara[n-1-i]);
        adj[ara[n-1-i]].push_back(ara[i]);
    }

    int ans = 0;
    for(int i = 1; i <= 2e5; i++){
        if(!vis[i]){
            c = 0;
            dfs(i);
            ans += (c-1);
        }
    }
    cout<<ans<<endl;
}
