program ABC_073_B_Theater
   implicit none
   integer N, i
   integer, allocatable :: l(:), r(:)
   read(*, *) N
   allocate(l(1: N))
   allocate(r(1: N))
   do i = 1, N
       read(*, *) l(i), r(i)
   end do
   write(*, *) sum(r - l) + N
end program ABC_073_B_Theater