n, m = map(int, input().split())
imos = [0] * (n + 1)
for _ in range(m):
    l, r = map(int, input().split())
    imos[l-1] += 1
    imos[r] -= 1
cnt = 1 if imos[0] == m else 0
for i in range(1, n):
    imos[i] += imos[i-1]
    if imos[i] == m:
        cnt += 1
print(cnt) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m imos = [0] * (n + 1) imos [0] * (n + 1) [0] 0 n + 1 n 1 for _ in range(m):
    l, r = map(int, input().split())
    imos[l-1] += 1
    imos[r] -= 1 _ range(m) range m l, r = map(int, input().split()) l map(int, input().split()) map int input().split() ().split () input split r imos[l-1] += 1 imos[l-1] imos l-1 l 1 1 imos[r] -= 1 imos[r] imos r 1 cnt = 1 if imos[0] == m else 0 cnt 1 if imos[0] == m else 0 imos[0] == m imos[0] imos 0 m 1 0 for i in range(1, n):
    imos[i] += imos[i-1]
    if imos[i] == m:
        cnt += 1 i range(1, n) range 1 n imos[i] += imos[i-1] imos[i] imos i imos[i-1] imos i-1 i 1 if imos[i] == m:
        cnt += 1 imos[i] == m imos[i] imos i m cnt += 1 cnt 1 print(cnt) print cnt cnt = 1 if imos[0] == m else 0 1 if imos[0] == m else 0 cnt n, m = map(int, input().split()) map(int, input().split()) n cnt += 1 1 cnt r = map(int, input().split()) map(int, input().split()) r m = map(int, input().split()) map(int, input().split()) m imos = [0] * (n + 1) [0] * (n + 1) imos l, r = map(int, input().split()) map(int, input().split()) l
n, m = map(int, input().split())
imos = [0] * (n + 1)
for _ in range(m):
    l, r = map(int, input().split())
    imos[l-1] += 1
    imos[r] -= 1
cnt = 1 if imos[0] == m else 0
for i in range(1, n):
    imos[i] += imos[i-1]
    if imos[i] == m:
        cnt += 1
print(cnt)
