#include<iostream> #include<cstdio> #include<cctype> using namespace std; inline int read() { int x=0,f=1;char c=getchar(); while(!isdigit(c)){if(c=='-')f=-1;c=getchar();} while(isdigit(c)){x=(x<<3)+(x<<1)+(c^48);c=getchar();} return x*f; } int f[100001],n,m,l,r,t; inline int lowbit(int x){return x&(-x);} inline void updata(int x,int i) { for(;i<=n;i+=lowbit(i)) f[i]+=x; } inline int sum(int i) { int ans=0; for(;i;i-=lowbit(i)) ans+=f[i]; return ans; } int main() { n=read();m=read(); while(m--) { t=read(); if(t==1){ l=read();r=read(); updata(1,l);updata(-1,r+1); } if(t==2){ l=read(); l=sum(l); if(l&1)l=1; else l=0; printf("%d ",l); } } return 0; }