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

const int MX = 2000005;
vector<vector<int>> g(MX);
vector<int> a;
int ans = 0;
vector<bool> used(MX , false);

void dfs(int v , int &depth) {
  if (used[v]) {
    return;
  }
  used[v] = true;
  for (int v2 : g[v]) {
    if (!used[v2]) {
      depth++;
      dfs(v2 , depth);
    }
  }
  return;
}

int main() {
  int n;
  cin >> n;
  a = vector<int>(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n / 2; i++) {
    g[a[i]].push_back(a[n - 1 - i]);
    g[a[n - 1 - i]].push_back(a[i]);
  }

  for (int i = 0; i < n / 2; i++) {
    int depth = 0;
    dfs(a[i] , depth);
    ans += depth;
  }
  cout << ans << endl;
  return 0;
}

#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define put(i) cout << i << endl
#define rep(i, s, n) for (long long i = s; i < (long long)(n); i++)
using namespace std;
using ll = long long;

ll n;
vector<ll> a;

struct UnionFind {
    vector<int> r;

    UnionFind(int N) { r = vector<int>(N + 1, -1); }

    int root(int x) {
        if (r[x] < 0) return x;
        return r[x] = root(r[x]);
    }

    bool unite(int x, int y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (r[x] > r[y]) swap(x, y);
        r[x] += r[y];
        r[y] = x;
        return true;
    }

    int size(int x) { return -r[root(x)]; }
};

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

    UnionFind UF(*max_element(all(a)));

    ll ans = 0;

    rep(i, 0, n / 2) { UF.unite(a[i], a[n - 1 - i]); }

    set<ll> st, st2;
    for (auto x : a) st.insert(x);

    rep(i, 0, n) { st2.insert(UF.root(a[i])); }

    put(st.size() - st2.size());
}
