#include using namespace std; signed main(){ int N; cin >> N; vector< int > A( N ); for( int i = 0; i < N; ++i ) cin >> A[ i ]; vector< pair< int, int > > ans; for( int i = 0; i < N; ++i ) for( int j = 0; j + 1 < N; ++j ) if( A[ j ] > A[ j + 1 ] ) swap( A[ j ], A[ j + 1 ] ), ans.emplace_back( j, j + 1 ); cout << ans.size() << endl; for( int i = 0; i < ans.size(); ++i ) cout << ans[ i ].first << " " << ans[ i ].second << endl; int dummy; cin >> dummy; return 0; }