L,M=map(int,input().split()) dict={x:True for x in range(L+1)} for i in range(M): x,y=map(int,input().split()) for j in range(x,y+1): dict[j]=False res=0 for key in dict: if dict[key]==True: res+=1 print(res)
L,M=map(int,input().split()) dict={x:True for x in range(L+1)} for i in range(M): x,y=map(int,input().split()) for j in range(x,y+1): dict[j]=False res=0 for key in dict: if dict[key]==True: res+=1 print(res)