#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> count(200000, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    count[A[i] - 1]++;
  }
  for (int i = 0; i < N; i++) {
    count[A[i] - 1]--;
    for (int j = (count.size()); j >= 0; j--) {
      if (count[j] >= 1) {
        cout << (j + 1) << endl;
        break;
      }
    }
    count[A[i] - 1]++;
  }
  return 0;
}
