#include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
const int N = 5e5;
std::vector<std::vector<int>> tr(4 << std::__lg(N));
void rangeApply(int u, int l, int r, int L, int R, int v) {
if(l >= L and r <= R) {
tr[u].push_back(v);
} else {
int mid = l + r >> 1;
if(L <= mid) {
rangeApply(u << 1, l, mid, L, R, v);
}
if(R > mid) {
rangeApply(u << 1 | 1, mid + 1, r, L, R, v);
}
}
}
void solve() {
int n;
std::cin >> n;
std::vector<int> l(n + 1), r(n + 1), v(n + 1);
std::vector<std::vector<int>> last(N + 1);
for(int i = 1; i <= n; i ++ ) {
int op, x;
std::cin >> op >> x;
if(op == 1) {
l[i] = i;
r[i] = n;
v[i] = x;
last[x].push_back(i);
} else {
r[last[x].back()] = i - 1;
last[x].pop_back();
}
}
// return;
for(int i = 1; i <= n; i ++ ) {
if(l[i] != 0) {
rangeApply(1, 1, n, l[i], r[i], v[i]);
}
}
std::vector<int> ans(n + 1);
auto dfs = [&](auto &self, int u, int l, int r, std::bitset<N + 1> b) -> void {
for(auto x : tr[u]) {
b |= b << x;
}
if(l == r) {
ans[l] = b.count() - 1;
return;
}
int mid = l + r >> 1;
self(self, u << 1, l, mid, b);
self(self, u << 1 | 1, mid + 1, r, b);
};
std::bitset<N + 1> b;
b[0] = 1;
dfs(dfs, 1, 1, n, b);
for(int i = 1; i <= n; i ++ ) {
std::cout << ans[i] '\n';
}
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int T = 1;
// std::cin >> T;
while(T -- ) {
solve();
}
return 0;
}