Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
// Problem: A. Adrenaline Rush
// Contest: Codeforces - 2024-2025 ICPC, NERC, Northern Eurasia Finals (Unrated, Online Mirror, ICPC Rules, Teams Preferred)
// URL: https://codeforces.com/contest/2052/problem/A
// Memory Limit: 1024 MB
// Time Limit: 3000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

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

#define rep(n) for (int _i_i_ = (n); _i_i_; --_i_i_)
#define mem(arr, x) memset((arr), x, sizeof (arr))
#define mkp make_pair
#define edge(y, x, ver) for (int _i_ = h[x], y = ver[_i_]; _i_; y = ver[_i_ = nxt[_i_]])
#define import mt19937
#define random rnd(chrono::system_clock::now().time_since_epoch().count())
#define setdb(v) setprecision(v)
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int maxn = 1e3 + 5;

int n;
int c, p[maxn];

void solve() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> c;
		p[c] = i;
	}
	vector<pii> ans;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			ans.emplace_back(j, i);
			if (p[i] < p[j]) ans.emplace_back(i, j);
		}
	}
	cout << ans.size() << '\n';
	for (auto &[x, y] : ans) cout << x << ' ' << y << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int t = 1;
	//cin >> t;
	rep (t) {
		solve();
	}
	return 0;
}

/*
+---------------------------------------------+
|GREY|GREEN|CYAN|BLUE|PURPLE|YELLOW|ORANGE|RED|
+---------------------------------------------+
*/

Submission (verdict: Wrong answer on test 7):
// Problem: A. Adrenaline Rush
// Contest: Codeforces - 2024-2025 ICPC, NERC, Northern Eurasia Finals (Unrated, Online Mirror, ICPC Rules, Teams Preferred)
// URL: https://codeforces.com/contest/2052/problem/A
// Memory Limit: 1024 MB
// Time Limit: 3000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

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

#define rep(n) for (int _i_i_ = (n); _i_i_; --_i_i_)
#define mem(arr, x) memset((arr), x, sizeof (arr))
#define mkp make_pair
#define edge(y, x, ver) for (int _i_ = h[x], y = ver[_i_]; _i_; y = ver[_i_ = nxt[_i_]])
#define import mt19937
#define random rnd(chrono::system_clock::now().time_since_epoch().count())
#define setdb(v) setprecision(v)
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int maxn = 1e3 + 5;

int n;
int c, p[maxn];

void solve() {
	cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> c;
		p[c] = i;
	}
	vector<pii> ans;
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			ans.emplace_back(j, i);
		}
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = i + 1; j <= n; ++j) {
			if (p[i] < p[j]) ans.emplace_back(i, j);
		}
	}
	cout << ans.size() << '\n';
	for (auto &[x, y] : ans) cout << x << ' ' << y << '\n';
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	int t = 1;
	//cin >> t;
	rep (t) {
		solve();
	}
	return 0;
}

/*
+---------------------------------------------+
|GREY|GREEN|CYAN|BLUE|PURPLE|YELLOW|ORANGE|RED|
+---------------------------------------------+
*/