Our old friend Alexey has finally entered the University of City N — the Berland capital. Alexey expected his father to get him a place to live in but his father said it was high time for Alexey to practice some financial independence. So, Alexey is living in a dorm. 

The dorm has exactly one straight dryer — a 100 centimeter long rope to hang clothes on. The dryer has got a coordinate system installed: the leftmost end of the dryer has coordinate 0, and the opposite end has coordinate 100. Overall, the university has n students. Dean's office allows i-th student to use the segment (l_{i}, r_{i}) of the dryer. However, the dean's office actions are contradictory and now one part of the dryer can belong to multiple students!

Alexey don't like when someone touch his clothes. That's why he want make it impossible to someone clothes touch his ones. So Alexey wonders: what is the total length of the parts of the dryer that he may use in a such way that clothes of the others (n - 1) students aren't drying there. Help him! Note that Alexey, as the most respected student, has number 1.


-----Input-----

The first line contains a positive integer n (1 ≤ n ≤ 100). The (i + 1)-th line contains integers l_{i} and r_{i} (0 ≤ l_{i} < r_{i} ≤ 100) — the endpoints of the corresponding segment for the i-th student.


-----Output-----

On a single line print a single number k, equal to the sum of lengths of the parts of the dryer which are inside Alexey's segment and are outside all other segments.


-----Examples-----
Input
3
0 5
2 8
1 6

Output
1

Input
3
0 10
1 5
7 15

Output
3



-----Note-----

Note that it's not important are clothes drying on the touching segments (e.g. (0, 1) and (1, 2)) considered to be touching or not because you need to find the length of segments.

In the first test sample Alexey may use the only segment (0, 1). In such case his clothes will not touch clothes on the segments (1, 6) and (2, 8). The length of segment (0, 1) is 1.

In the second test sample Alexey may dry his clothes on segments (0, 1) and (5, 7). Overall length of these segments is 3.

Difficulty: interview

Starter code:

Solutions:
N = int(input())
sush = [0] * 101
for i in range(1, N + 1) :
    l, r = [int(s) for s in input().split()]
    for j in range(l, r) :
        sush[j] = (1 if i == 1 else 0)
print(str(sum(sush)))

n=int( input() )
l=[]
r=[]

for i in range( 0, n ):
    a=list(map(int,input().split()))
    l.append(a[0])
    r.append(a[1])

ans=0
for j in range( l[0], r[0] ):
    for k in range(1, n):
        if j<r[k] and j>=l[k]:
            break
    else:
        ans+=1

print(str(ans))


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

n = int(input())
w = [False for i in range(101)]
a, b = map(int, input().split())
s = -1
e = -1
cnt = 0

for i in range(n - 1):
	c, d = map(int, input().split())
	for j in range(c, d):
		w[j] = True

for i in range(a, b):
	if not w[i]:
		cnt += 1

print(cnt)

n = int(input())
a1 = list()
for i in range(0,101):
	a1.insert(i,0)
#	print(a1[i])
for i in range(0,n):
	a,b = list(map(int,input().split()))
	#print(i)
	if i!=0:
		for j in range(a, b):
			#print(j)
			a1[j] = 1
			#print(a1[j])
	else:
		l = a
		r = b
ans = 0
for i in range(l, r):
	#print(i)
	if a1[i]==0:
		ans = ans+1
print(ans)
	


n = int(input())
d = [1] * 100
a, b = map(int, input().split())
for _ in range(n - 1):
  l, r = map(int, input().split())
  for i in range(l, r):
    d[i] = 0
print(sum(d[a:b]))

import time
import io
import math
import random

def timer(f):
    def tmp(*args, **kwargs):
        t = time.time()
        res = f(*args, **kwargs)
        print("Time : %f" % (time.time()-t))
        return res

    return tmp



n = int(input());
array = []
for i in range(n):
    str = input().split(' ')
    array.append([int(str[0]), int(str[1])])

summ = 0
x = array[0][0]
y = array[0][1]
for i in range(x*100, y*100):
    coord = i/100
    f = True
    for j in range(1, len(array)):
        if array[j][0] <= coord <= array[j][1]:
            f = False
    if f:
        #print(coord)
        summ = summ+1

print(int(round(summ/100)))



import sys; sys.setrecursionlimit(1000000)

def solve():
    n, = rv()
    count = [0] * 100
    leftmost, rightmost, = rv()
    for seg in range(n - 1):
        left, right, = rv()
        for val in range(left, right):
            count[val]+=1
    res = 0
    for val in range(leftmost, rightmost):
        if count[val] == 0: res+=1
    print(res)

def rv(): return list(map(int, input().split()))
def rl(n): return [list(map(int, input().split())) for _ in range(n)]
if sys.hexversion == 50594544 : sys.stdin = open("test.txt")
solve()




from sys import setrecursionlimit, exit, stdin
from math import ceil, floor, acos, pi
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from functools import reduce
import itertools
setrecursionlimit(10**7)
RI=lambda x=' ': list(map(int,input().split(x)))
RS=lambda x=' ': input().rstrip().split(x)
dX= [-1, 1, 0, 0,-1, 1,-1, 1]
dY= [ 0, 0,-1, 1, 1,-1,-1, 1]
mod=int(1e9+7)
eps=1e-6
MAX=1000
#################################################
taken=[0]*100
n=RI()[0]
l1, r1 = RI()
for i in range(1, n):
    l, r = RI()
    for j in range(l, r):
        taken[j]=1
ans=0
for i in range(l1, r1):
    if not taken[i]:
        ans+=1
print(ans)


    


n = int(input())
dryer = [0]*101

al,ar = map(int,input().split())

for i in range(1,n):
    l,r = map(int,input().split())

    for j in range(l,r):
        dryer[j] = 1

x = 0
for i in range(al,ar):
    if dryer[i] == 0 :
        x += 1

print(x)

n = int(input())
m, M = list(map(int, input().split()))
x = set((i, i + 1) for i in range(m, M))
for _ in range(n - 1):
    a, b = list(map(int, input().split()))
    for i in range(a, b):
        if (i, i + 1) in x:
            x.remove((i, i + 1))
print(len(x))


n = int(input())
d = [1] * 100
a, b = map(int, input().split())
for _ in range(n - 1):
  l, r = map(int, input().split())
  for i in range(l, r):
    d[i] = 0
print(sum(d[a:b]))

n = int(input())
a,b  = list(map(int,input().split()))
li=[]
for i in range(n-1):
  x,y  = list(map(int,input().split()))
  li.append([x,y])
arr = [0]*(100+1)
for i in range(n-1):
  arr[li[i][0]] +=1 
  arr[li[i][1]] -=1
s,ans= 0,0
for i in range(b+1):
  if i >a and s==0:
    ans+=1
  s+=arr[i]
print(ans)    
    


def main():
    from collections import defaultdict
    n = int(input())
    s = defaultdict(int)
    (aa, ab) = list(map(int, input().split(' ')))
    l = []
    for i in range(n - 1):
        (a, b) = list(map(int, input().split(' ')))
        l.append((a, b))
        while a < b:
            s[a] += 1
            a += 1
    r = 0
    while aa < ab:
        if s[aa] == 0:
            r += 1
        aa += 1
    return r
print(main())


# python 3
"""
"""
from operator import itemgetter


def on_segments_own_points(segment_list) -> int:
    alexey_l, alexey_r = segment_list[0]
    if len(segment_list) == 1:
        return alexey_r - alexey_l

    segment_list.sort(key=itemgetter(0))
    # print(segment_list)
    l_curr, r_curr = segment_list[0]  # current l, r
    i = 0
    # find the Alexey segment
    while not (l_curr == alexey_l and r_curr == alexey_r):
        i += 1
        l_curr, r_curr = segment_list[i]
    # now l_curr, r_curr hold the l and r for Alexey
    if i > 0:
        l_curr, r_curr = max(segment_list[:i], key=itemgetter(1))
        if r_curr >= alexey_r:
            return 0
        elif alexey_l <= r_curr < alexey_r:
            start = r_curr
        else:
            start = alexey_l
    else:
        start = alexey_l
    non_overlapped = 0
    # print(start, segment_list[i], segment_list[i+1])
    for j in range(i+1, len(segment_list)):
        l_curr, r_curr = segment_list[j]
        # print(start, l_curr, r_curr, alexey_r)
        if start < l_curr:
            if l_curr < alexey_r:
                non_overlapped += l_curr - start
                if r_curr > alexey_r:
                    return non_overlapped
                else:
                    start = r_curr
                # print("go:", start, non_overlapped)
            else:
                return alexey_r - start
        elif start > r_curr:
            continue
        else:
            if r_curr < alexey_r:
                start = r_curr
            else:
                return non_overlapped
    if start < alexey_r:
        return non_overlapped + alexey_r - start
    return non_overlapped


def __starting_point():
    """
    Inside of this is the test. 
    Outside is the API
    """
    n = int(input())
    segments = [tuple(map(int, input().split())) for i in range(n)]

    print(on_segments_own_points(segments))

__starting_point()

from sys import stdin, stdout

n = int(stdin.readline().strip())
alex = list(map(int, stdin.readline().strip().split()))
alex_lst = list(range(alex[0] + 1, alex[1] + 1))
for i in range(1, n):
    lst = list(map(int, stdin.readline().strip().split()))
    for j in range(lst[0] + 1, lst[1] + 1):
        if j in alex_lst:
            alex_lst.remove(j)
stdout.write(str((len(alex_lst))))

# Made By Mostafa_Khaled 
bot = True 
n = int(input())

d = [1] * 100

a, b = list(map(int, input().split()))

for _ in range(n - 1):

  l, r = list(map(int, input().split()))

  for i in range(l, r):

    d[i] = 0

print(sum(d[a:b]))

# Made By Mostafa_Khaled


n = int(input())
a = [0] * 100
la, ra = map(int, input().split())
for i in range(1, n):
    l, r = map(int, input().split())
    a[l] += 1
    if r < 100:
        a[r] -= 1
for i in range(1, 100):
    a[i] += a[i - 1]
ans = 0
for i in range(la, ra):
    if a[i] == 0:
        ans += 1
print(ans)

n = int(input())
lrs = []

alr = input().split()
al = int(alr[0])
ar = int(alr[1])
at = ar - al

for i in range(n-1):
    lr = input().split()
    l = (int(lr[0]), 'l')
    r = (int(lr[1]), 'r')
    lrs.append(l)
    lrs.append(r)

slrs = sorted(lrs, key = lambda x: x[0])

c = 0
lt = 101

for i in range(2 * (n - 1)):
    cur = slrs[i]
    if cur[1] == 'l':
        c += 1
        if c == 1:
            lt = cur[0]
    else:
        c -= 1
        if c == 0:
            if al <= cur[0] and cur[0] <= ar:
                if lt >= al:
                    at -= (cur[0] - lt)
                elif lt < al:
                    at -= (cur[0] - al)
            elif ar < cur[0]:
                if lt <= al:
                    at = 0
                elif al < lt and lt < ar:
                    at -= (ar - lt)
            if at <= 0:
                break
            lt = 101

print(at)


from itertools import accumulate

n = int(input())

mas = list([0 for x in range(101)])

x0, y0 = list(map(int, input().split()))

for i in range(n - 1):
    x, y = list(map(int, input().split()))
    
    mas[x] += 1
    mas[y] -= 1

ans = list(accumulate(mas))[x0:y0].count(0)

print(ans)


a=list()
n=int(input())
c=[1]*100
l,r=map(int,input().split())
for i in range(n-1):
    b=list(map(int,input().split()))
    for j in range(b[0],b[1]):
        c[j]=0
print(sum(c[l:r]))

import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())

n = mint()
a = []
for i in range(n):
	a.append(tuple(mints()))
r = 0
for i in range(*a[0]):
	r += 1
	for j in range(1,len(a)):
		z = a[j]
		if z[0]<=i and z[1]>i:
			r -= 1
			break
print(r)

n = int(input())

al, ar = [int(x) for x in input().split()]

alexSpace = {x: True for x in range(al, ar)}

for i in range(1, n):
    l, r = [int(x) for x in input().split()]
    for i1 in range(l, r):
    	if i1 in alexSpace.keys():
        	alexSpace[i1] = False

print(len({x: isFree for x, isFree in alexSpace.items() if isFree}))

n=int(input())
a=[1]*100
x,y=map(int,input().split())
for i in range(n-1):
	l,r=map(int,input().split())
	for j in range(l,r):
		a[j]=0;
print(sum(a[x:y]))

n = int(input())
Al_r = input()
Al = int(Al_r.split(' ')[0])
Ar = int(Al_r.split(' ')[1])
Al_rList = list(range(Al,Ar))
for i in range(n-1):
    l_r = input()
    l = int(l_r.split(' ')[0])
    r = int(l_r.split(' ')[1])
    l_rList = list(range(l, r))
    for i in l_rList:
        if i in Al_rList:
            Al_rList.remove(i)
print(len(Al_rList))