# import bisect

# import copy

# import fractions

# import math

# import numpy as np

# from collections import Counter, deque

# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product



def resolve():

    N=int(eval(input()))

    cnt=0

    for i in range(N):

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

        cnt+=r-l+1

    print(cnt)





resolve()
import sys

sys.setrecursionlimit(10 ** 5 + 10)

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



def resolve():

    cnt=0

    N=int(eval(input()))

    for i in range(N):

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

        cnt+=r-l+1

    print(cnt)



resolve()
# import bisect
# import copy
# import fractions
# import math
# import numpy as np
# from collections import Counter, deque
# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product
def resolve():
    N = int(eval(input()))
    cnt = 0
    for i in range(N):
        l, r = list(map(int, input().split()))
        cnt += r - l + 1
    print(cnt)


resolve()

import sys

sys.setrecursionlimit(10**5 + 10)


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


def resolve():
    cnt = 0
    N = int(eval(input()))
    for i in range(N):
        l, r = list(map(int, input().split()))
        cnt += r - l + 1
    print(cnt)


resolve()

-# import bisect -# import copy -# import fractions -# import math -# import numpy as np -# from collections import Counter, deque -# from itertools import accumulate,permutations, combinations,combinations_with_replacement,product +import sys + +sys.setrecursionlimit(10**5 + 10) + + +def input(): +    return sys.stdin.readline().strip() + + +    cnt = 0 -    cnt = 0