#include<bits/stdc++.h>
using namespace std;
#define int long long
int L[4000007],R[4000007],lazy[4000007],seg[4000007],timer=2;
void push(int l,int r,int node){
if(lazy[node]){
seg[node]=(r-l+1);
if(l!=r){
if(!L[node]) L[node]=timer++;
if(!R[node]) R[node]=timer++;
lazy[L[node]]=true;
lazy[R[node]]=true;
}
lazy[node]=false;
}
}
void update(int cl,int cr,int l,int r,int node){
push(cl,cr,node);
if(cl>r || cr<l) return ;
if(cl>=l && cr<=r){
lazy[node]=true;
push(cl,cr,node);
return ;
}
int mid=(cl+cr)>>1;
if(!L[node]) L[node]=timer++;
if(!R[node]) R[node]=timer++;
update(cl,mid,l,r,L[node]);
update(mid+1,cr,l,r,R[node]);
seg[node]=seg[L[node]]+seg[R[node]];
}
int query(int cl,int cr,int l,int r,int node){
if(!node) return 0;
push(cl,cr,node);
if(cl>r || cr<l) return 0;
if(cl>=l && cr<=r){
return seg[node];
}
int mid=(cl+cr)>>1;
return query(cl,mid,l,r,L[node])+query(mid+1,cr,l,r,R[node]);
}
signed main(){
ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
int m; cin >> m;
int C=0;
while(m--){
int t1,t2,t3; cin >> t1 >> t2 >> t3;
if(t1==1){
C=query(-1e9,1e9,t2+C,t3+C,1);
cout << C << '\n';
}
else{
update(-1e9,1e9,t2+C,t3+C,1);
}
}
}