#include <bits/stdc++.h>   using namespace std;   const int INF = 0x3f3f3f3f;   const long long LINF = 0x3f3f3f3f3f3f3f3f;   int v[1010];   bool compare(pair<int, int> a, pair<int, int> b) {     if (a.second != b.second) return a.second > b.second;     if (v[a.first] != v[b.first]) return v[a.first] < v[b.first];     return a.first < b.first;   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     int n;     cin >> n;     for (int i = 0; i < n; i++) cin >> v[i];     vector<pair<int, int> > ret;     for (int i = 0; i < n; i++) {       for (int j = i + 1; j < n; j++) {         if (v[j] < v[i]) ret.push_back({i, j});       }     }     sort(ret.begin(), ret.end(), compare);     cout << ret.size() <<   n ;     for (auto x : ret) {       cout << x.first + 1 <<     << x.second + 1 <<   n ;     }     exit(0);   }   