#include <stdio.h> #include <stdlib.h> int cmp(const void* a, const void* b) { return *(int*)a > *(int*)b; } int main() { int n; while (scanf("%d", &n) != EOF) { int max = -1; int a[n]; for (int i = 0; i < n; i++) { scanf("%d", &a[i]); if (a[i] > max) { max = a[i]; } } if (n == 1) { printf("%d\n", max); printf("-1\n"); } else { qsort(a, n, sizeof(int), cmp); printf("%d\n", max); for (int i = 0; i < n - 1; i++) { printf("%d ", a[i]); } printf("\n"); } } return 0; }