#!/usr/bin/env pypy3

def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    N=I()

    ans=0

    for i in range(N):

        l,r=MI()

        ans+=r-l+1

    print(ans)

        



main()

import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=10**9+7

    N=I()

    ans=0

    for i in range(N):

        l,r=MI()

        ans+=(r-l)+1

        

    print(ans)



main()

#!/usr/bin/env pypy3
def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    N = I()
    ans = 0
    for i in range(N):
        l, r = MI()
        ans += r - l + 1
    print(ans)


main()

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 10**9 + 7
    N = I()
    ans = 0
    for i in range(N):
        l, r = MI()
        ans += (r - l) + 1
    print(ans)


main()

-#!/usr/bin/env pypy3 +import sys + +input = sys.stdin.readline + + -        ans += r - l + 1 +        ans += (r - l) + 1