#include<iostream> #include<algorithm> using namespace std; int main() { int n; while (cin>>n) { int array[n]; for (int i = 0; i < n; i++) { cin >> array[i]; } sort(array, array + n); int temp = array[n-1]; cout << temp << endl; if(n==1) { cout<<-1; } else {for (int i = 0; i < n-1; i++) { cout<<array[i] << " "; } } } return 0; }