/*
    written by Pankaj Kumar.
    country:-INDIA
    Institute: National Institute of Technology, Uttarakhand
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll ;
typedef unsigned long long ull;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define speed cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
/*  Abbrevations  */
#define ff first
#define ss second
#define mp make_pair
#define line cout<<endl;
#define pb push_back
#define Endl "\n"
// loops
#define forin(arr,n) for(ll i=0;i<n;i++) cin>>arr[i];
// Some print
#define no cout<<"No"<<endl;
#define yes cout<<"Yes"<<endl;
// sort
#define all(V) (V).begin(),(V).end()
#define srt(V) sort(all(V))
#define srtGreat(V) sort(all(V),greater<ll>())
// some extra
#define printv(v) for(ll i=0;i<ll(v.size());i++){cout<<v[i]<<" ";} line;
#define precision(x) cout<<fixed<<setprecision(x);
#define sz(V) ll(V.size())
// template
template <typename T>
T mymax(T x,T y)
{
    return (x>y)?x:y;
}
// function
ll power(ll x,ll y,ll mod)
{
    ll res=1;
    // x=x%mod;
    while(y>0)
    {
        if(y%2==1)
        {
            res*=x;
            // res=res%mod;
        }
        y/=2; x*=x; // x=x%mod;
    }
    return res;
}
ll str_to_num(string s)
{
    return stoi(s);
}

string num_to_str(ll num)
{
    return to_string(num);
}
// datatype definination
#define ordered_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
class Point
{
    public:
        ll x;
        ll y;
        ll z;
        ll getsum()
        {
            return x+y+z;
        }
};
/* ascii value 
A=65,Z=90,a=97,z=122
*/
/* Some syntax 
//Syntax to create a min heap for priority queue
//priority_queue <int, vector<int>, greater<int>>pq;
*/


/*  --------------------MAIN PROGRAM----------------------------*/
// to run ctrl+b
const ll INF=1e18;
const ll mod1=1e9+7;
const ll mod2=998244353;


// Techniques :
// divide into cases, brute force, pattern finding
// sort, greedy, binary search, two pointer
// transform into graph

// Experience :
// Cp is nothing but only observation and mathematics.
vector<int>aa[200001];
int vis[200001];
 
void dfs(int node, int par, int& dis){
    vis[node]=1;
    dis++;
    for(auto child:aa[node]){
        if(vis[child]==0 and child!=par){
            dfs(child, node, dis);
        }
    }
}

ll solve()
{
    int n;
    cin>>n;
    int a[n];
    for(ll i=0;i<n;i++)
        cin>>a[i];
    vector<pair<int, int>>v;
    set<int>s;
    for(int i=0;i<n/2;i++){
        if(a[i]!=a[n-1-i]){
            v.pb({a[i], a[n-1-i]});
            s.insert(a[i]);
            s.insert(a[n-1-i]);
        }
    }
    if(v.size()==0){
        cout<<0<<endl;
        return 0;
    }
        
    for(auto x : v){
        aa[x.ff].pb(x.ss);
        aa[x.ss].pb(x.ff);
    }
        
        
    int ans =0;
    for(auto i:s){
        if(vis[i]==0){
            int d = 0;
            dfs(i, 0, d);
            // cout<<d<<endl;
            ans += max(0, (d-1));
        }
    }
        
    cout<<ans<<endl;
    return 0;
}

int main()
{
    speed;
    /* #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif */
    ll TestCase=1;
    // cin>>TestCase;
    while(TestCase--)
    {
        solve();
    }
}
/* -----------------END OF PROGRAM --------------------*/
/*
* stuff you should look before submission 
* constraint and time limit
* int overflow
* special test case (n=0||n=1||n=2)
* don't get stuck on one approach if you get wrong answer
*/
#include <bits/stdc++.h>
#define sz(c) int(c.size())
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define per(i, a, b) for (int i = (b)-1; i >= (a); --i)
using namespace std;
using ll = long long;

#ifdef LOCAL
#include <local/debug.h>
#else
#define debug(...) (void)0
#endif

struct DSU {
  vector<int> r;
  DSU(int n) : r(n, -1) {}
  int get(int x) { return r[x] < 0 ? x : r[x] = get(r[x]); }
  int size(int x) { return -r[get(x)]; }
  bool join(int x, int y) {
    x = get(x), y = get(y);
    if (x == y)
      return false;
    if (r[x] > r[y])
      swap(x, y);
    r[x] += r[y];
    r[y] = x;
    return true;
  }
};

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

  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, 0, n) cin >> a[i];

  int const maxa = 200001;
  DSU dsu(maxa);
  rep(i, 0, n / 2) dsu.join(a[i], a[n - i - 1]);

  ll res = 0;
  rep(i, 0, maxa) if (i == dsu.get(i)) res += dsu.size(i) - 1;
  cout << res << "\n";
}
