n,q=map(int,input().split()) p=[0]*n anss=[] for i in range(q): l,r=map(int,input().split()) for j in range(l-1,r): if p[j]==1: p[j]=0 else: p[j]=1 anss.append(p.count(1)) for x in anss: print(x)