N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(int, input().split())))
resList = [0]*N
for i in range(M):
  resList[List[i][0]-1] +=1
  if List[i][1]<N:
    resList[List[i][1]] +=-1
for j in range(1,N):
  resList[j] = resList[j] + resList[j-1]
print(resList.count(M)) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M List = [] List [] for i in range (M):
  List.append(list(map(int, input().split()))) i range (M) range M List.append(list(map(int, input().split()))) List.append List append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split resList = [0]*N resList [0]*N [0] 0 N for i in range(M):
  resList[List[i][0]-1] +=1
  if List[i][1]<N:
    resList[List[i][1]] +=-1 i range(M) range M resList[List[i][0]-1] +=1 resList[List[i][0]-1] resList List[i][0]-1 List[i][0] [i] List i 0 1 1 if List[i][1]<N:
    resList[List[i][1]] +=-1 List[i][1]<N List[i][1] [i] List i 1 N resList[List[i][1]] +=-1 resList[List[i][1]] resList List[i][1] [i] List i 1 -1 for j in range(1,N):
  resList[j] = resList[j] + resList[j-1] j range(1,N) range 1 N resList[j] = resList[j] + resList[j-1] resList[j] resList j resList[j] + resList[j-1] resList[j] resList j resList[j-1] resList j-1 j 1 print(resList.count(M)) print resList.count(M) resList.count resList count M M=map(int,input().split()) map(int,input().split()) M List = [] [] List N,M=map(int,input().split()) map(int,input().split()) N resList = [0]*N [0]*N resList
N,M=map(int,input().split())
List = []
for i in range (M):
  List.append(list(map(int, input().split())))
resList = [0]*N
for i in range(M):
  resList[List[i][0]-1] +=1
  if List[i][1]<N:
    resList[List[i][1]] +=-1
for j in range(1,N):
  resList[j] = resList[j] + resList[j-1]
print(resList.count(M))