func_code_string: #include <bits/stdc++.h>   using namespace std;   long n, ps[1000], tp, q, ar[1000], ans, x, y, a, b;   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 1; i <= n; i++) {       cin >> ar[i];       ps[ar[i]] = i;     }     cin >> q;     for (; q; --q) {       cin >> tp;       if (tp == 2) {         cin >> a >> b;         swap(ar[a], ar[b]);         ps[ar[a]] = a;         ps[ar[b]] = b;       } else {         cin >> x >> y;         ans = 1;         while (x < y) {           if (ps[x + 1] < ps[x]) ++ans;           ++x;         }         cout << ans << endl;       }     }     cin.get();     cin.get();     return 0;   }   