#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec;
  int a = 0;
  int x = 1;
  int mex = 0;
  cin >> x;
  while (cin >> a) {
    a = a % x;
    if (a == mex % x) {
      vec.push_back(mex);
      sort(vec.begin(), vec.end());
      for (int i = 0; i < vec.size() + 1; i++) {
        if (count(vec.begin(), vec.end(), i)) {
        } else {
          mex = i;
        }
      }
    } else {
      while (count(vec.begin(), vec.end(), a)) {
        a += x;
      }
      vec.push_back(a);
    }
    cout << mex << endl;
  }
}
