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

int main() {
    long long n;
    cin>>n;
    long long A[n];
    long long B[n];
    vector<long long>ans;
    for(int i=0;i<n;i++){
        cin>>A[i];
        B[i]=A[i];
    }
    cout<<"1"<<endl;
    cout<<n<<" "<<"1";
    /*/
    sort(B,B+n);
    for(int i=0;i<n;i++){
        for(int j=i;j<n;j++){
            if(B[i]==A[j] && i!=j){
                reverse(A+i,A+j+1);
                ans.push_back(i+1);
                ans.push_back(j+1);
                break;
            }
        }
    }
    cout<<ans.size()/2<<endl;
    for(int i=0;i<ans.size();i+=2){
        cout<<ans[i]<<" "<<ans[i+1]<<endl;
    }
    /*/
}
