#include <bits/stdc++.h> using namespace std; int n,a[1005],ans,b[1005],c[1005][1005],s; //n:8 //a:389 207 175 300 299 170 158 165 //b:158 165 //c:389 207 175 170 158 // 300 299 165 int main(){ cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; bool f=false; for(int j=1;j<=ans;j++){ if(b[j]>a[i]){ f=true; c[j][s++]=b[j]; b[j]=a[i]; break; } } if(!f){ ans++; b[ans]=a[i]; } } cout<<ans<<endl; for(int i=1;i<=ans;i++){ cout<<i<<":"; for(int j=1;j<=n;j++){ cout<<c[i][j]<<" "; } cout<<endl; } return 0; } /************************************************************** Problem: 1375 User: chenjingqi Language: C++ Result: Wrong Answer ****************************************************************/