n, m = map(int, input().split())
cardid_2_num_map = [0] * (10**5 + 2)

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

for i in range(1, n + 1):
    cardid_2_num_map[i] += cardid_2_num_map[i - 1]

max_sum_num = max(cardid_2_num_map)
count_max_card = cardid_2_num_map.count(max_sum_num)

if max_sum_num == m:
    print(count_max_card)
else:
    print(0) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m cardid_2_num_map = [0] * (10**5 + 2) cardid_2_num_map [0] * (10**5 + 2) [0] 0 10**5 + 2 10**5 10 5 2 for i in range(m):
    l, r = map(int, input().split())
    cardid_2_num_map[l] += 1
    cardid_2_num_map[r + 1] -= 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 cardid_2_num_map[l] += 1 cardid_2_num_map[l] cardid_2_num_map l 1 cardid_2_num_map[r + 1] -= 1 cardid_2_num_map[r + 1] cardid_2_num_map r + 1 r 1 1 for i in range(1, n + 1):
    cardid_2_num_map[i] += cardid_2_num_map[i - 1] i range(1, n + 1) range 1 n + 1 n 1 cardid_2_num_map[i] += cardid_2_num_map[i - 1] cardid_2_num_map[i] cardid_2_num_map i cardid_2_num_map[i - 1] cardid_2_num_map i - 1 i 1 max_sum_num = max(cardid_2_num_map) max_sum_num max(cardid_2_num_map) max cardid_2_num_map count_max_card = cardid_2_num_map.count(max_sum_num) count_max_card cardid_2_num_map.count(max_sum_num) cardid_2_num_map.count cardid_2_num_map count max_sum_num if max_sum_num == m:
    print(count_max_card)
else:
    print(0) max_sum_num == m max_sum_num m print(count_max_card) print count_max_card print(0) print 0 max_sum_num = max(cardid_2_num_map) max(cardid_2_num_map) max_sum_num r = map(int, input().split()) map(int, input().split()) r n, m = map(int, input().split()) map(int, input().split()) n l, r = map(int, input().split()) map(int, input().split()) l count_max_card = cardid_2_num_map.count(max_sum_num) cardid_2_num_map.count(max_sum_num) count_max_card cardid_2_num_map = [0] * (10**5 + 2) [0] * (10**5 + 2) cardid_2_num_map m = map(int, input().split()) map(int, input().split()) m
n, m = map(int, input().split())
cardid_2_num_map = [0] * (10**5 + 2)

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

for i in range(1, n + 1):
    cardid_2_num_map[i] += cardid_2_num_map[i - 1]

max_sum_num = max(cardid_2_num_map)
count_max_card = cardid_2_num_map.count(max_sum_num)

if max_sum_num == m:
    print(count_max_card)
else:
    print(0)