#include<iostream>
#include<iomanip>
#include<cstring>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<memory>
using namespace std;
const int k=100006;
struct Node{
int p,q;
}tree[4*k];
int n,t,a,b;
void xg(int l,int r,int root){
if(b<l || r<a) return;
if(l>=a && r<=b){
tree[root].maxx++;
tree[root].delta++;
return;
}
int mid=(l+r)/2,q=tree[root].q;
tree[root*2].p+=q;
tree[root*2].q+=q;
tree[root*2+1].p+=q;
tree[root*2+1].q+=q;
tree[root].q=0;
xg(l,mid,root*2);
xg(mid+1,r,root*2+1);
tree[root].p=max( tree[root*2].p, tree[root*2+1].p);
return;
}
int ss(int l,int r,int root){
if(l>b || r<a) return(-99999999);
if(l>=a && r<=b) return(tree[root].p);
int mid=(l+r)/2,delta=tree[root].q;
tree[root*2].p+=q;
tree[root*2].q+=q;
tree[root*2+1].p+=q;
tree[root*2+1].q+=q;
tree[root].q=0;
return(max( ss(l,mid,root*2), ss(mid+1,r,root*2+1)));
}
int main(){
freopen("3.in","r",stdin);
freopen("3.out","w",stdout);
memset(tree,0,sizeof(tree));
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d%d%d",&t,&a,&b);
if(t==1) xg(1,n,1);
if(t==2) printf("%d\n",ss(1,n,1));
}
return 0;
}