#include<bits/stdc++.h>
using namespace std;
typedef pair<int , int> f;
vector<f> d;
bool cmp(int a, int b){
    if(b<a) {
        d.push_back({b, a});
        return b >= a;
    }
}
int main(){
    int n, a[100007];
    cin>>n;
    for(int i=1; i<=n; i++){
        cin>>a[i];
    }
    sort(a+1, a+1+n, cmp);
    cout<<d.size()<<endl;
    for (auto x: d){
        cout<<x.first<<" "<<x.second<<endl;
    }

}