program main
    implicit none
    integer N, i, ans
    integer :: l(1010) = 0
    integer :: r(1010) = 0
    ans = 0
    read *, N
    do i = 1,N
        read *, l(i), r(i)
        ans = ans + r(i) - l(i) + 1
    end do

    print *, ans
end program main
