program ABC073B
    implicit none
    integer(8)::N,l,r,i
    integer(8)::result=0
    read(5,*)N

    do i=1,N
        read(5,*)l,r
        result=result+r-l+1
    end do

    print'(i0)',result
end program ABC073B