#include <iostream>
#include <map>
#include <vector>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <climits>
#include <ctime>
#include <iomanip>
#include <string>

using namespace std;


    
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin>>n;
    int a[n+1];
    vector<int> p;
    for(int i = 1; i <= n; i++)
    {
        cin>>a[i];
        p.push_back(a[i]);
    }
    sort(p.begin(), p.end());
    deque <int> d;
    for(auto i:p)
    {
        d.push_back(i);
    }
    int res = 0;
    vector<pair<int,int>> re;
    for(int i = 0; i < n; i++)
    {
        if(d.empty()) break;
        int x = d.back();
        d.pop_back();
        while(a[i+1] == x)
        {
            if(d.empty()) break;
            x = d.back();
            d.pop_back();
        }
        if(d.empty()) break;
        for(int j = i + 1; j <= n; j++)
        {
            if(a[j] == x)
            {
                res++;
                re.push_back({1, j});
                if(i != 0)
                {
                    res++;
                    re.push_back({2, j});
                }   
            }
        }
        if(d.empty()) break;
    }
    res++;
    re.push_back({1, n});
    cout<<res<<'\n';
    for(auto k:re)
    {
        cout<<k.first<<" "<<k.second<<'\n';
    }
}