#include<bits/stdc++.h>
using namespace std;
#define int long long
multiset<int> A;
int buns=0;
deque<int> mommy;
int N;
int opt,x;
signed main(){
cin>>N;
for(int i=0;i<N;i++){
cin>>opt;
if(opt==1){
cin>>x;
x+=buns;
A.insert(x);
mommy.push_back(x);
}
else{
cin>>x;
buns+=x;
while(!A.empty() and buns>=*A.begin()){
A.erase(A.begin());
}
while(!mommy.empty() and buns>=mommy.front()){
mommy.pop_front();
}
cout<<mommy.size()-A.size()<<"\n";
}
}
}