n, m = map(int, input().split())

s = [0] * (n + 1)
for i in range(m):
    l, r = map(int, input().split())
    s[l - 1] += 1
    s[r] -= 1

for i in range(n):
    s[i + 1] += s[i]
print(s.count(m)) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m s = [0] * (n + 1) s [0] * (n + 1) [0] 0 n + 1 n 1 for i in range(m):
    l, r = map(int, input().split())
    s[l - 1] += 1
    s[r] -= 1 i range(m) range m l, r = map(int, input().split()) l map(int, input().split()) map int input().split() ().split () input split r s[l - 1] += 1 s[l - 1] s l - 1 l 1 1 s[r] -= 1 s[r] s r 1 for i in range(n):
    s[i + 1] += s[i] i range(n) range n s[i + 1] += s[i] s[i + 1] s i + 1 i 1 s[i] s i print(s.count(m)) print s.count(m) s.count s count m n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m r = map(int, input().split()) map(int, input().split()) r s = [0] * (n + 1) [0] * (n + 1) s l, r = map(int, input().split()) map(int, input().split()) l
n, m = map(int, input().split())

s = [0] * (n + 1)
for i in range(m):
    l, r = map(int, input().split())
    s[l - 1] += 1
    s[r] -= 1

for i in range(n):
    s[i + 1] += s[i]
print(s.count(m))
