#include<iostream> #include<cstdio> #include<algorithm> using namespace std; int main(){ int n; int array[1000]; while(scanf("%d\n",&n)!=EOF){ for(int i=0;i<n;++i){ scanf("%d ",&array[i]); } sort(array,array+n); cout<<array[n-1]<<endl; --n; if(n){ for(int i=0;i<n;++i){ cout<<array[i]<<" "; } } else{ cout<<-1; } cout<<endl; } return 0; }