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

bool vis[200001] = {false};
vector<int> graph[200001];

void dfs(int node,  int par , int& temp){
  vis[node] = true;
  temp++;
  for(auto& c : graph[node]){
    if(vis[c] == false)
      dfs(c , node , temp);
  }
}
int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++) cin>>a[i];
  unordered_set<int> s;
  vector<pair<int,int>> v;
  int lo = 0;
  int hi = n-1;
  while(lo < hi){
    if(a[lo] != a[hi]){
       v.push_back({a[lo],a[hi]});
       s.insert(a[lo]);
       s.insert(a[hi]);
     }
     lo++;
     hi--;
  }

  if(v.size() == 0)
    {
      cout<<"0"<<endl;
      
    }
  else{
      for(pair<int,int>& p : v){
        graph[p.first].push_back(p.second);
        graph[p.second].push_back(p.first);
      }
      long long int ans = 0;
      for(auto& item : s){
         if(vis[item] == false){
           int temp = 0;
           dfs(item , 0 , temp);
           ans += max(0 , temp-1);
         }
      }

      cout<<ans<<endl;
  }
  
  
  return 0;

}
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
// avoid unordered_map and unordered_set!!!
#include <vector>
#include <utility>

using namespace std;

using i64 = int64_t;
using u64 = uint64_t;
using i32 = int32_t;
using pi64 = pair<i64, i64>;

#define vec vector
#define let const
#define DRi64(x) i64 x; cin >> x;
#define DRS(x) string x; cin >> x;
#define DRVi64(v, n) vec<i64> v(n); { for (i64 i = 0; i < n; ++i) { cin >> v[i]; }}
#define DRpi64(x) pi64 x; cin >> x.first >> x.second;

#ifdef DEBUG
#define P(x) cerr << x << "\n"
#else
#define P(x)
#endif

constexpr i64 MAXN = 2*100*1000LL+5LL;
constexpr i64 MOD = 1000000007LL;
constexpr i64 INF64 = MOD * MOD;

template<bool one_indexed>
struct union_find_t
{
    union_find_t(const i64 N)
        : parents_(N + one_indexed), sizes_(N + one_indexed, 1)
    {
        iota(parents_.begin(), parents_.end(), 0LL);
    }

    i64 Find(const i64 x)
    {
        if (parents_[x] != x)
        {
            parents_[x] = Find(parents_[x]);
        }
        return parents_[x];
    }

    void Union(const i64 a, const i64 b)
    {
        let i64 r_a = Find(a);
        let i64 r_b = Find(b);
        if (r_a == r_b)
        {
            return;
        }
        if (sizes_[r_a] < sizes_[r_b])
        {
            Union(r_b, r_a);
            return;
        }
        sizes_[r_a] += sizes_[r_b];
        parents_[r_b] = r_a;
    }

    vec<i64> parents_;
    vec<i64> sizes_;
};

int
main()
{
    ios_base::sync_with_stdio(false);
    // fast io: see 1423K
    cin.tie(nullptr);
    cout.tie(nullptr);

    DRi64(N);
    DRVi64(A, N);

    union_find_t<true> uf(MAXN);
    set<i64> distinct;
    for (i64 i = 0; i < N / 2; ++i)
    {
        if (A[i] == A[N - 1 - i])
        {
            continue;
        }
        uf.Union(A[i], A[N - 1 - i]);
        distinct.insert(A[i]);
        distinct.insert(A[N - 1 - i]);
    }

    i64 acc = 0;
    set<i64> roots_seen;
    for (let i64 x : distinct)
    {
        let i64 r = uf.Find(x);
        if (roots_seen.count(r))
        {
            continue;
        }
        roots_seen.insert(r);
        acc += uf.sizes_[r] - 1;
    }
    cout << acc << "\n";

    return 0;
}
