
N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]

MAX = N + 2
array = [0] * (MAX)

for l, r in X:
    array[l] += 1
    array[r + 1] -= 1

for i in range(MAX - 1):
    array[i + 1] += array[i]

print(sum(v == M for v in array)) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M list(map(int, input().split())) for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split X = [list(map(int, input().split())) for _ in range(M)] X [list(map(int, input().split())) for _ in range(M)] MAX = N + 2 MAX N + 2 N 2 array = [0] * (MAX) array [0] * (MAX) [0] 0 MAX for l, r in X:
    array[l] += 1
    array[r + 1] -= 1 l r X array[l] += 1 array[l] array l 1 array[r + 1] -= 1 array[r + 1] array r + 1 r 1 1 for i in range(MAX - 1):
    array[i + 1] += array[i] i range(MAX - 1) range MAX - 1 MAX 1 array[i + 1] += array[i] array[i + 1] array i + 1 i 1 array[i] array i print(sum(v == M for v in array)) print sum(v == M for v in array) sum v == M v M array = [0] * (MAX) [0] * (MAX) array X = [list(map(int, input().split())) for _ in range(M)] [list(map(int, input().split())) for _ in range(M)] X MAX = N + 2 N + 2 MAX M = map(int, input().split()) map(int, input().split()) M N, M = map(int, input().split()) map(int, input().split()) N

N, M = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(M)]

MAX = N + 2
array = [0] * (MAX)

for l, r in X:
    array[l] += 1
    array[r + 1] -= 1

for i in range(MAX - 1):
    array[i + 1] += array[i]

print(sum(v == M for v in array))
