#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
using namespace std;
int ch=1e9;
int a,b,c,d,x,n,n1,F,n2,fl1,fl2,t,o1,o2,flag,flag1,flag2,g,m,m1,m2,i,j,lr,f,k,l,r,y,o,p,mx=-ch,mx1=-ch,mx2=-ch,q,q1,q2,q3,q4,mn=ch,mn1=ch,mn2=ch,f1,f2,pos,ans,sum,sz=1,MOD=1e9+7;
int A[50005];
int B[50005];
pair < int , int > C[50005];
vector < pair < int , int > > v;
int pr()
{
    ll sum=0;
    for(int i=1;i<=n;i++)
    {
        C[i].ff=A[i];
        C[i].ss=i;
    }
    sort(C+1,C+n+1);
    for(int i=1;i<=n;i++)
    {
        sum+=abs(i-C[i].ss);
    }
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    if (n>5000) assert(false);
    cout<<0;return 0;
    for(i=1;i<=n;i++)
    {
        cin>>A[i];
        B[i]=A[i];
    }
    sort(B+1,B+n+1);
    while(true)
    {
        q=0;
        for(i=1;i<=n;i++)
        {
//            cout<<i<<" "<<A[i]<<" "<<B[i]<<"!\n";
            if (A[i]==B[i]);
            else
            {
                q=i;
                a=B[i];
                break;
            }
        }
        if (q==0) break;
        for(i=q;i<=n;i++)
        {
            if (A[i]==a)
            {
                b=i;
            }
        }
//        cerr<<q<<" "<<a<<" "<<b<<"\n";
        mn=1e9;
        for(i=b-1;i>=q;i--)
        {
            for(l=i;l<=b;l++)
            {
                if (l<b-(l-i)) swap(A[l],A[b-(l-i)]);
            }
            F=(b-i+1)+pr();
            for(l=i;l<=b;l++)
            {
                if (l<b-(l-i)) swap(A[l],A[b-(l-i)]);
            }
            if (F<=mn)
            {
                mn=F;ans=i;
            }
        }
        v.pb({ans,b});
        i=ans;
        for(l=i;l<=b;l++)
        {
//            cout<<ans<<" "<<l<<" "<<b-(l-i)<<"!\n";
            if (l<b-(l-i))
            {
//                cout<<l<<" "<<b-(l-i)<<"?\n";
                swap(A[l],A[b-(l-i)]);
//                cout<<A[l]<<" "<<A[b-(l-i)]<<"+\n";
            }
        }
    }
    cout<<v.size()<<"\n";
    for(i=0;i<v.size();i++)
    {
        cout<<v[i].ff<<" "<<v[i].ss<<"\n";
    }
}
