#include <bits/stdc++.h>
using namespace std;
long long b[1000001],c[1000001],j;

bool cmp (long long s1, long long s2)
{
if(s1>s2)
{
j=j+1;
b[j]=s1;
c[j]=s2;    
return false;
}
return true;
}

int main() 
{
 long long a[100001],n,m,f,k,i,l;
 cin >> n;
 for(i=0;i<n;i++)
 cin >> a[i];
 j=0;
 sort(a,a+n,cmp);
 cout << j << endl;
 for(i=1;i<=j;i++)
 cout << b[i] << ' ' << c[i] << endl;
}
