#include <bits/stdc++.h>
#include <unordered_set>
#include <algorithm>
 
using namespace std;
 
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vll = vector<ll>;
using vs = vector<string>;
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repll(i,n) for (ll i = 0; i < (ll)(n); i++)
#define fore(x,a) for(auto&(x) : (a))
 
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
 
#define ALL(a) (a).begin(), (a).end()
 
const ll INFL = 1e18;
const int INFI = 1e9;
const int MOD = 1e9 + 7;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = -1;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] < 0) return x;
        return par[x] = root(par[x]); //経路圧縮
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        // 要素数を片寄する
        int sx = par[rx];
        int sy = par[ry];

        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        par[ry] = sx + sy;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) { // データxが属する木の根の要素数
		return -par[root(x)];
	}
};
 
int main(){
  int N;
  cin >> N;
  vll A(N);
  rep(i,N) {
    cin >> A[i];
  }
  vll B,C;

  ll M = N;
  if(M % 2 == 1) M = (M - 1) /2;
  else M /= 2; 
  B.resize(M);
  C.resize(M);

  set<ll> S;

  repll(i, M){
    B[i] = A[i];
    C[i] = A[N - 1 - i];
    if(B[i] != C[i]) {
      S.insert(B[i]);
      S.insert(C[i]);
    }
  }

  map<ll, ll> bcmap;
  ll cnt = 0;
  fore(x, S) {
    bcmap[x] = cnt;
    cnt++;
  }

  ll size = S.size();
  UnionFind uf(size);
  repll(i, M){
    if(B[i] != C[i]){
      uf.unite(bcmap[B[i]], bcmap[C[i]]);
    }
  }

  map<ll, ll> rmap;
  set<ll> root;
  repll(i, size){
    rmap[uf.root(i)]++;
    root.insert(uf.root(i));
  }

  ll ans = 0;
  fore(x, root) {
    ans += rmap[x] - 1;
  }

  cout << ans << endl;
}
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define int long long int
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vpi vector<pair<int,int>>
#define pii pair<int,int>
#define pb push_back
#define inf 1e18
#define ff first
#define ss  second
#define deb(x) cout<<#x<<" "<<x<<endl;
#define all(x) x.begin(),x.end()
#define endl "\n"
const int maxn = 1e5;
void runcases(int T)
{

     int n;
     cin >> n;
     string s;
     cin >> s;
     vi v(2 * n, 0);
     for (int i = 0; i < 2 * n; i++) {
          v[i] = i;
     }
     int q;
     cin >> q;
     int cnt = 0;
     for (int i = 0; i < q; i++) {
          int t, a, b;
          cin >> t;
          if (t == 1)
          {    cin >> a >> b;
               a--;
               b--;
               if (cnt)
               {
                    if (a + n >= 2 * n)
                    {
                         a -= n;
                    } else {
                         a += n;
                    }
                    if (b + n >= 2 * n)
                    {
                         b -= n;
                    } else {
                         b += n;
                    }

               }
               swap(v[a], v[b]);

          } else if (t == 2)
          {
               cin >> a >> b;
               cnt = (cnt + 1) % 2;
          }
     }

     // fo
     string s1, s2;

     for (int i = 0; i < n; i++)
     {
          s1.push_back(s[v[i]]);
     }
     for (int i = n; i < 2 * n; i++)
     {
          s2.push_back(s[v[i]]);
     }
     if (cnt)
     {
          cout << s2 << s1 << endl;
     } else cout << s1 << s2 << endl;



     //cout<<"Case #"<<T<<": ";
}

int32_t main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);
     int T = 1;
     //cin >> T;
     for (int t = 1; t <= T; t++) {
          runcases(t);
     }

     return 0;
}
