#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i, a, n) for (int i = a; i < n; i++)
#define loope(i, b, n) for (int i = b; i <= n; i++)
#define loopit(a) for (auto it = a.begin(); it != a.end(); it++)
#define ms(a, b) memset(a, b, sizeof(a))
#define pb(a) push_back(a)
#define MP make_pair
#define pi pair<int, int>
#define ff first
#define ss second
#define bloop(i, a, b) for (int i = a; i > b; i--)
#define bloope(i, a, b) for (int i = a; i >= b; i--)
#define PQ priority_queue<int> pq;
#define vi vector<int>
#define vii vector<vector<int>>
#define si set<int>
#define NO cout<<"NO\n";
#define YES cout<<"YES\n";
#define MPQ priority_queue<pi, vector<int>, greater<pi>> mpq;
#define io                        \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
// #include < ext / pb_ds / assoc_container.hpp >
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//         tree_order_statistics_node_update>
//         ordered_set;
ll ceil(ll a, ll b) {
    return (a + b - 1) / b;
}
//graph theory
vector<vi> adj;
vi vis;

int dfs(int cur) {
    int ret = 1;
    vis[cur] = 1;
    // cout << cur << ",";
    for (const auto &v : adj[cur]) {
        if (vis[v])continue;
        ret += dfs(v);
    }
    return ret;
}
const int maxm = 2 * 1e5 + 1;

void solve()
{
    int n; cin >> n;
    vi a(n);
    loop(i, 0, n)cin >> a[i];
    adj = vector<vi>(maxm + 1);
    vis = vi(maxm + 1);

    int ans = 0;
    loop(i, 0, n / 2) {
        if (a[i] == a[n - i - 1])continue;
        adj[a[i]].pb(a[n - i - 1]);
        adj[a[n - i - 1]].pb(a[i]);
    }

    loop(i, 0, n) {
        if (vis[a[i]])continue;
        ans += dfs(a[i]) - 1;
        // cout << "\n";
        // cout << a[i] << " " << ans << "\n";
    }
    cout << ans << "\n";
}
int main()
{
    io;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int test = 1, i = 0;
    // cin >> test;
    while (i++ != test)
    {
        // cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}

#include <bits/stdc++.h>

using namespace std;

const long long MOD = 1000000007;

#define ll long long

vector<bool>vis ( 2e5+10 ,false);

vector<int>adj[200009];


void dfs ( int a){
     
     if(vis[a]==false)return;

    vis[a]=false;

    for ( int x : adj[a]){
        dfs(x);
    }
    
}


void solve()
{

    int n;
    cin >> n;

    vector<int> v(n);
    set<int>st;
    
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        st.insert(v[i]);
        vis[v[i]]=true;
    }

    int ans =st.size();

    int i=0,j=n-1;


    while ( i< j){

        adj[v[i]].push_back(v[j]);
        adj[v[j]].push_back(v[i]);
        i++;
        j--;

    }

    for ( int i=1 ; i<=200000; i++){
        if(vis[i]==true){
            ans--;
        
    
            dfs(i);
        }


    }

    cout << ans;

    
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    solve();

    return 0;
}