#include <bits/stdc++.h>

using namespace std;

const int MOD = 1000000007;
const int MAX32 = 2147483647;
const double PI = 3.14159265358979323846;

int main() {
  long long n, p, min = 0;
  cin >> n;
  vector<char> num(300000, 0);
  for (int i = 0; i < n; i++) {
    cin >> p;
    num[p] = 1;
    while (num[min]) {
      min++;
    }
    cout << min << endl;
  }
}

#include<bits/stdc++.h>
using namespace std;
const int N=100;
string  a[N];
long long dp[N];
int main(){
    int  n;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=n;i++){
        if(a[i]=="AND")
            dp[i]=dp[i-1];
        else 
            dp[i]=dp[i-1]+(1LL<<i);
    }
    cout<<dp[n]+1;
    return 0;
}