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