n,m=map(int,input().split())
L=[0]*m
R=[0]*m
table=[0]*(n+2)
for i in range(m):
   L[i],R[i]=map(int,input().split())
   table[L[i]]+=1
   table[R[i]+1]-=1
s=[0]*(n+2)#累積和をするリスト
for i in range(1,n+2):
   s[i]=s[i-1]+table[i]
print(s.count(m)) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m L=[0]*m L [0]*m [0] 0 m R=[0]*m R [0]*m [0] 0 m table=[0]*(n+2) table [0]*(n+2) [0] 0 n+2 n 2 for i in range(m):
   L[i],R[i]=map(int,input().split())
   table[L[i]]+=1
   table[R[i]+1]-=1 i range(m) range m L[i],R[i]=map(int,input().split()) L[i] L i map(int,input().split()) map int input().split() ().split () input split R[i] R i table[L[i]]+=1 table[L[i]] table L[i] L i 1 table[R[i]+1]-=1 table[R[i]+1] table R[i]+1 R[i] R i 1 1 s=[0]*(n+2) s [0]*(n+2) [0] 0 n+2 n 2 for i in range(1,n+2):
   s[i]=s[i-1]+table[i] i range(1,n+2) range 1 n+2 n 2 s[i]=s[i-1]+table[i] s[i] s i s[i-1]+table[i] s[i-1] s i-1 i 1 table[i] table i print(s.count(m)) print s.count(m) s.count s count m R=[0]*m [0]*m R m=map(int,input().split()) map(int,input().split()) m table=[0]*(n+2) [0]*(n+2) table L=[0]*m [0]*m L n,m=map(int,input().split()) map(int,input().split()) n s=[0]*(n+2) [0]*(n+2) s
n,m=map(int,input().split())
L=[0]*m
R=[0]*m
table=[0]*(n+2)
for i in range(m):
   L[i],R[i]=map(int,input().split())
   table[L[i]]+=1
   table[R[i]+1]-=1
s=[0]*(n+2)#累積和をするリスト
for i in range(1,n+2):
   s[i]=s[i-1]+table[i]
print(s.count(m))