#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <cmath>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using P = pair<int,int>;
#define INF 1001001001
#define LINF (1LL<<60)
#define F first
#define S second
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

struct UnionFind {
  vector<int> p;
  vector<int> sizes;
  UnionFind(int n) : p(n), sizes(n, 1) {
    rep(i,n) p[i] = i;
  }
  int find(int x) {
    if (x == p[x]) return x;
    return p[x] = find(p[x]);
  }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    if (sizes[x] < sizes[y]) swap(x, y);
    p[y] = x;
    sizes[x] += sizes[y];
  }
  bool isSame(int x, int y) {
    return find(x) == find(y);
  }
  int size(int x) {
    return sizes[find(x)];
  }
};

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  if (n == 1) {
    cout << 0 << endl;
    return 0;
  }
  int M = 200010;
  UnionFind uf(M);
  int ans = 0;
  rep(i, n) uf.unite(a[i], a[n-1-i]);
  rep(i, M) {
    if (i != uf.find(i)) continue;
    ans += uf.size(i)-1;
  }
  cout << ans << endl;
}

#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

struct UF {
  int n;
  vector<int> par;
  vector<int> rank;
  UF(int n) : n(n) {
    for (int i = 0; i < n; ++i) {
      par.resize(n);
      rank.resize(n);
      par.at(i) = i;
      rank.at(i) = 0;
    }
  }

  int find(int x) {
    if (par.at(x) == x) {
      return x;
    } else {
      return par.at(x) = find(par.at(x));
    }
  }

  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;

    if (rank.at(x) < rank.at(y)) {
      par.at(x) = y;
    } else {
      par.at(y) = x;
      if (rank.at(x) == rank.at(y)) rank.at(x)++;
    }
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  int solve() {
    unordered_map<int, int> m;
    for (int i = 0; i < n; ++i) {
      
      m[find(i)]++;
    }
    int ans = 0;
    for (auto p : m) {
      ans += p.second - 1; 
    }
    return ans;
  }
};

int main() {

  int n;
  cin >> n;
  int key = 0;
  vector<int> a(n);
  unordered_map<int, int> m;
  for (int i = 0; i < n; ++i) {
    cin >> a.at(i);
    if (m.find(a.at(i)) == m.end()) {
      m[a.at(i)] = key;
      key++;
    }
  }

  UF uf(key);
   
  for (int i = 0; i < (n+1) / 2; ++i) {
    int x = m.at(a.at(i));
    int y = m.at(a.at(n-i-1));
    if (x != y) {
      uf.unite(x, y);
    }
  }
  cout << uf.solve() << endl;
  return 0;
}
