#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int N;
  scanf("%d", &N);
  int array[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &array[i]);
  }
  int max = 0;
  for (int i = 0; i < N; i++) {
    max = 0;
    for (int j = 0; j < N; j++) {
      if (i == j) {
      } else if (max <= array[j]) {
        max = array[j];
      }
    }
    printf("%d", max);
  }
  return 0;
}
