#include<bits/stdc++.h> using namespace std; int main() { int n, i; cin >> n; int a[n]; for(i = 0; i < n; i++) { cin >> a[i]; } sort(a, a+n);//排序 cout << a[n-1] << endl;//输出最大的值 if(n == 1) { cout << -1 << endl; } else { for(i = 0 ; i< n-1; i++) { if(i != n-2) { cout << a[i] << " "; } else { cout << a[i] << endl; } } } return 0; }