Problem:
 Score : 200 points    Problem Statement Joisino is working as a receptionist at a theater.  The theater has 100000 seats, numbered from 1 to 100000 .  According to her memo, N groups of audiences have come so far, and the i -th group occupies the consecutive seats from Seat l_i to Seat r_i (inclusive).  How many people are sitting at the theater now?      Constraints  1≤N≤1000  1≤l_i≤r_i≤100000  No seat is occupied by more than one person.  All input values are integers.         Input Input is given from Standard Input in the following format:  N  l_1  r_1  :  l_N  r_N       Output Print the number of people sitting at the theater.        Sample Input 1 1
24 30      Sample Output 1 7  There are 7 people, sitting at Seat 24,25,26,27,28,29 and 30 .       Sample Input 2 2
6 8
3 3      Sample Output 2 4

Solution (Python):
N = int(input())
cnt = 0
for i in range(N):
    l, r = map(int, input().split())
    cnt += r - l + 1
print(cnt)

Solution (Python):
n = int(input().strip())
total = 0
for _ in range(n):
    l, r = [int(x) for x in input().strip().split()]
    total += r - l + 1
print(total)

Solution (Python):
N = input()
s=0
for i in range(int(N)):
	l,r=map(int,raw_input().split())
	s+=r-l+1
print(s)

Solution (Python):
ans = 0
for i in range(int(input())):
  r1, r2 = input().split()
  ans += int(r2) - int(r1) + 1
print(ans)

Solution (Python):
n = int(input())
count = 0

for i in range(n) :
    l,m = map(int,input().split())
    count += m-l+1

print(count)

Solution (Python):
c=[0]*100010
N=int(input())
for _ in range(N):
  a,b=map(int,input().split())
  c[a] += 1
  c[b+1] -= 1
for i in range(len(c)-1):
  c[i+1] += c[i]
print(sum(c))

Solution (Python):
print(sum([(lambda x:int(x[1])+1-int(x[0]))(input().split())for _ in[0]*int(input())]))

Solution (Python):
N=int(input())
ans=N
for i in range(N):
  a,b=map(int,input().split())
  ans+=b-a
print(ans)

Solution (Python):
n = int(input())
ans = 0

for i in range(n):
    a,b = (int(i) for i in input().split())
    ans += b-a+1
print(ans)

Solution (Python):
N = int(input())
seat = 0
for _ in range(N):
    l,r = map(int,input().split())
    seat += r - l + 1
print(seat)

Solution (Python):
N = raw_input()
N = int(N)

sum_n = 0
for i in range(N):
	s_input = raw_input()
	s_input = s_input.split(' ')
	s_input = [int(d) for d in s_input]
	sum_n += s_input[1] - (s_input[0] - 1)

print(sum_n)

Solution (Python):

DEBUG = False



result = 0
ELEM_MAX = 100000 
seat_list = []


if DEBUG:
    N = '3'
    a = '1 2'

else:
    N = input()
    N = int(N)
    for i in range(N):
        seat = input()
        seat = seat.split(' ')
        seat = list(map(int, seat))
        seat_list.append(seat)


for seat in seat_list:
    result += seat[1] - seat[0] + 1


print(result)

Solution (Python):
group_num = int(input())
number_of_customer = 0
for _ in range(group_num):
    l = list(map(int, input().split()))
    number_of_customer += l[1] - l[0] + 1
print (number_of_customer)

Solution (Python):
n = int(input())

sum = 0

for i in range(n):
    l, r = map(int, input().split(" "))

    sum += r - l + 1

print(sum)

Solution (Python):
N = int(input())

ans = 0

for _ in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1
    
print(ans)

Solution (Python):
n = raw_input()

n = int (n)

ans=0

for i in range(0,n):
    a,b=raw_input().split(' ')
    a = int (a)
    b = int (b)
    ans+=b-a;
    ans+=1

print ans

Solution (Python):
ans = 0
for i in range(input()):
    l, r = map(int, raw_input().split())
    ans += r - l + 1
print ans

Solution (Python):
N=int(input())
ans=0
for i in range(N):
 l,r=map(int, input().split())
 ans+=r-l+1
print(ans)

Solution (Python):

num = 0
N = int(input())
for i in range(N):
    l = list(map(int, input().split()))
    num += l[1] - l[0] + 1

print(num)

Solution (Python):
N = int(input())
list_seki = []
for i in range(N):
    list_seki.append(list(map(int,input().split())))

count = 0
for j in range(N):
    count += list_seki[j][1]+1-list_seki[j][0]

print(count)

Solution (Python):
N= int(input())
n=[[]]
ans=0

for i in range(N):
    n.append(input().split())

for j in range(1,N+1):
    
    ans+=int(n[j][1])-int(n[j][0])
    ans+=1

print(ans)

Solution (Python):
s = 0
for i in range(int(input())):
    l, r = map(int, input().split())
    s += r - l + 1
print(s)

Solution (Python):
from collections import defaultdict
from itertools import product, groupby
from math import pi
from collections import deque
from bisect import bisect, bisect_left, bisect_right
INF = 10 ** 10


def main():
    N = int(input())
    ans = 0
    for _ in range(N):
        l, r = map(int, input().split())
        ans += r - l + 1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
count = 0
for i in range(n):
    a, b = (int(j) for j in input().split())
    count += (b - a) + 1

print(count)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = list(map(int, input().split()))
    ans += r - l + 1

print(ans)

Solution (Python):
N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

ans = 0
for l, r in X:
    ans += r - l + 1
print(ans)

Solution (Python):
n = int(input())
e = [input().split() for i in range(n)]
for i in range(n) :
	e[i] = [int(j) for j in e[i]]
x = 0
for i in range(n) :
	x += e[i][1]
	x -= e[i][0]
x += n
print(x)

Solution (Python):
import numpy as np


def getInput():
    """

    :return: list of list of str. 1st dim: row, 2nd dim: column.
    """
    separator = ' '
    ret_array = []
    while True:
        try:
            row = input().split(sep=separator)
            ret_array.append(row)
        except EOFError:
            break
    return ret_array


g = getInput()


N = np.array(list(map(int, g[0])), dtype=np.int32)

l = []
r = []
for row_idx in range(1, len(g)):
    l.append(int(g[row_idx][0]))
    r.append(int(g[row_idx][1]))

l = np.array(l, dtype=np.int32)
r = np.array(r, dtype=np.int32)

s = r-l+1

print(s.sum())

Solution (Python):
n = int(input())

ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Solution (Python):
N=input()
num=0
for i in range(N):
    x=map(int,raw_input().split())
    temp_num=len(range(x[0],x[1]+1))
    num=num+temp_num
print num

Solution (Python):
n = int(input())
c=0
for i in range(n):
    s,e = map(int,input().split())
    c += e-s+1
print(c)

Solution (Python):
n = int(input())
gokei = 0
for i in range(n):
    r , l = map(int, input().split())
    gokei += l - r + 1
print(gokei)

Solution (Python):
n=int(input())
ans=0
for _ in range(n):
    l,r=map(int,input().split())
    ans+=r-l+1
print(ans)

Solution (Python):
N = input()
cus = 0

for i in range(N):
    l = (map(int, raw_input().split()))
    cus += (l[1] - l[0] + 1)

print cus

Solution (Python):
N = int(input())
ans = 0
for _ in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Solution (Python):
audience = []
total = 0
groups = int(raw_input())

for line in xrange(groups):
    audience.append(raw_input())

for line in audience:
    group = map(int, line.split())
    total += group[1] - group[0] + 1

print total

Solution (Python):
N = int(input())
total = 0
for i in range(N):
    l,r = map(int,input().split())
    total += (r - l) + 1
print(total)

Solution (Python):
n = int(raw_input())
s = 0
for _ in range(n):
    l,r = map(int, raw_input().split())
    s += r - l + 1
print s

Solution (Python):


n=int(raw_input())
res=0
for i in xrange(n):
 l,r=map(int,raw_input().split())
 res+=r-l+1
print res

Solution (Python):
N=int(input())
ans=N
for i in range(N):
  a,b=map(int,input().split())
  ans+=b-a
print(ans)

Solution (Python):
N = int(input())
ans = 0

for i in range(N):
    l, r = map(int, input().split())
    ans += r-l+1

print(ans)

Solution (Python):
N=input()
now=0
for i in range(0,(int)(N)):
    lr=(input()).split(' ')
    now=now+((int)(lr[1])-(int)(lr[0])+1)

print(now)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = list(map(int, input().split()))
    ans += r - l + 1
print(ans)

Solution (Python):
def read(): return list(map(int, input().split()))

M = 100000
n = int(input())
seat = [0 for i in range(M)]

for i in range(n):
    l, r = read()
    l -= 1
    r -= 1
    for j in range(l, r+1):
        seat[j] = 1

print(sum(seat))

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Solution (Python):
ans = 0
for i in range(int(input())):
    a,b = map(int,input().split())
    ans += b-a+1
print(ans)

Solution (Python):
N = int(input())
l = [0] * N
r = [0] * N
for i in range(N):
    l[i], r[i] = map(int, input().split())

count = [0] * N
for i in range(N):
    count[i] = r[i] - l[i] + 1

print(sum(count))

Solution (Python):
def main():
    n = int(input())
    cnt = 0
    for _ in range(n):
        l, r = map(int, input().split())
        cnt += r-l+1
    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
	j,k = map(int,input().split())
	ans += k - j + 1
print(ans)

Solution (Python):

import sys


def main():

    NumCount = 0

    lines = sys.stdin.readlines()
    for i,line in enumerate(lines):
        if i==0:
            continue
        else:
            value = line.split()
            if len(value)==1:
                NumCount += 1
            else:
                NumCount += int(value[1])-int(value[0]) + 1
    print(NumCount)
    return


if __name__=='__main__':
    main()

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = list(map(int, input().split()))
    ans += r - l + 1
print(ans)

Solution (Python):
n=int(input())
ans=0
for i in range(n):
	a,b=map(int,input().split())
	ans+=b-a+1
print(ans)

Solution (Python):
N=int(input())
ans=0
for i in range(N):
    a,b=[int(k) for k in input().split()]
    ans+=b-a+1
print(ans)

Solution (Python):
print(sum([1+len(range(*list(map(int,input().split())))) for i in range(int(input()))]))

Solution (Python):
import functools, operator, math

res = 0
for _ in range(int(input())):
    res += abs(functools.reduce(operator.__sub__, map(int, input().split())))+1

print(res)

Solution (Python):
c=[0]*100010
N=int(input())
for _ in range(N):
  a,b=map(int,input().split())
  c[a] += 1
  c[b+1] -= 1
for i in range(len(c)-1):
  c[i+1] += c[i]
print(sum(c))

Solution (Python):
ans=0
for _ in range(int(raw_input())):
	l,r=map(int,raw_input().split())
	ans+=(r-l+1)
print ans

Solution (Python):
n = int(input())
a = 0
for _ in range(n):
    l,r = map(int,input().split())
    a += r-l+1
print(a)

Solution (Python):
n=int(input())
ans=0
for i in range(n):
    a,b=map(int,input().split())
    ans += b-a+1

print(ans)

Solution (Python):
import atexit
import io
import sys

temp_buffer = io.BytesIO()
sys.stdout = temp_buffer


@atexit.register
def write():
    sys.__stdout__.write(temp_buffer.getvalue())


result = 0
n = int(raw_input())
for i in range(n):
    l, r = map(int, raw_input().split())
    result += (r - l + 1)
print(result)

Solution (Python):
a=input()
ans=0
for i in range(a):
    b=map(int,raw_input().split())
    ans+=b[1]-b[0]+1
print ans

Solution (Python):
N = int(input())
answer = 0
for i in range(N):
	l, r = map(int, input().split())
	answer += r - l + 1
print(answer)

Solution (Python):
n = input()

ans = 0
for i in range(n):
    a, b = map(int, raw_input().split())
    ans += b - a + 1

print ans

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    a,b = map(int,input().split())
    ans += (b - a) + 1
print(ans)

Solution (Python):
from sys import stdin
ans = 0
n = int(stdin.readline())
for _ in xrange(n):
 l,r = map(int,stdin.readline().split())
 ans += r-l+1
print ans

Solution (Python):


ans = 0
N = int(input())
for i in range(N):
    a , b = map(int,input().split())
    ans = ans + b - a +1
print(ans)

Solution (Python):
import sys

written = set()

s = 0
N = int(sys.stdin.readline())
for i in range(N):
    l, r = list(map(int, input().split()))
    s += r - l + 1
print(s)

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
    L,R = map(int,input().split())
    ans += R-L +1

print(ans)

Solution (Python):
itera = input()
itera = int(itera)
total = 0

for i in range(0, itera):
	var1, var2 = input().split()
	var1 = int(var1)
	var2 = int(var2)
	total += (var2+1)-var1

print(total)

Solution (Python):
value = int(input())
people = 0
while True:
	try:
		seat = input()
		if seat:
			string_seat = seat.split()
			seat_list = []
			seat_list = [int(x) for x in (string_seat)]
			people += seat_list[len(seat_list)-1] - seat_list[0]+1
	except EOFError:
		break









print(people)

Solution (Python):
import sys




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


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    n = read_int()
    res = 0
    for i in range(n):
        l, r = read_int_list()
        r0 = r - l + 1
        res += r0
    print(res)


main()

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    a, b = list(map(int, input().split()))
    ans += b - a +1
print(ans)

Solution (Python):
N = int(raw_input())
ans = 0
for i in xrange(N):
    l, r = map(int, raw_input().split())
    ans += r - l + 1
print ans

Solution (Python):


n=int(input())
sum=0
for i in range(0, n):
    l_r=input()
    l=int(l_r.split(" ")[0])
    r=int(l_r.split(" ")[1])
    sum+=r-l+1

print(sum)

Solution (Python):
import sys

def main():
    N = int(input())

    a =[]
    for i in range(N):
        a.append(list(map(int,input().split())))


    count = 0

    for b in a:
        count = count + (b[1]-b[0]+1)

    print(count)


if __name__=='__main__':
    main()

Solution (Python):
n = int(input())
p = 0
for i in range(n):
    l, r = (int(i) for i in input().split())
    p += r-l + 1
print(p)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Solution (Python):
n = int(input())

ans = 0

for i in range(n):
	x,y=[int(i) for i in input().split()]
	ans +=  y-x+1
print(ans)

Solution (Python):
def solve(): 
    N = int(input())
    sum_seat = 0

    for _ in range(N):
        l, r = [int(x) for x in input().split(" ")]
        sum_seat += r + 1 - l

    print(sum_seat)
    
    
solve()

Solution (Python):
import numpy as np
hoge = input()
N = int(hoge)
data = np.zeros((N,2))
num = 0
for i in range(N):
    hoge = input()
    hoge = hoge.strip().split(" ")
    num += int(hoge[1])-int(hoge[0])+1
print(num)

Solution (Python):
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, = read_line(int)

count = 0

for _ in range(n):
    l, r = read_line(int, int)
    count += r - l +  1

print(count)

Solution (Python):
n = int(input())
print(sum([-int(eval(input().replace(' ', '-')))+1 for i in range(n)]))

Solution (Python):
n = int(input())
e = [[int(i) for i in input().split()] for i in range(n)]
result = 0
for i in e:
    result += i[1] - i[0]

print(result + n)

Solution (Python):
N = int(input())

ans = 0
for i in range(N):
    nums = list(map(int, input().split()))
    ans += nums[1] - nums[0] + 1

print(ans)

Solution (Python):
N = int(input())
sum = 0

for num in range(N):
	a, b = (int(_) for _ in raw_input().split()) 
	sum += b - a + 1

print(sum)

Solution (Python):


N = int(input())

res = 0
for i in range(N):
    l, r = tuple(map(int, input().split()))
    res += r - l + 1

print(res)

Solution (Python):

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

Solution (Python):
N = int(input())
f = lambda l,r: r-l+1
print(sum(f(*map(int,input().split())) for i in range(N)))

Solution (Python):
N = int(input())

sum = 0
for i in range(N):
    a = list(map(int,input().split()))
    sum += a[1] - a[0] + 1
print(sum)

Solution (Python):
def main():
    cnt = 0
    for _ in range(int(input())):
        l, r = map(int, input().split())
        cnt += r-l+1
    print(cnt)


if __name__ == "__main__":
    main()

Solution (Python):
import copy
import sys
import numpy as np

from math import *
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N] = [int(input_raw[0])]
    count = 0
    for i in range(N):
        input_raw = read_func().strip().split()
        [l, r] =[int(input_raw[0]), int(input_raw[1])]
        count += r - l + 1
    print count

if __name__ == '__main__':
    main()

Solution (Python):
def B_Theater(N, C):
    people = 0
    for i in range(0, len(C), 2):
        people += C[i + 1] - C[i] + 1
    return people

N = int(input())
C = [[int(i) for i in input().split()] for i in range(N)]
x = []
for s in C:
    x.extend(s)
C=x
print(B_Theater(N, C))

Solution (Python):
n=int(input())
sum1=0
for i in range(n):
    l,r=input().split()
    r=int(r)
    l=int(l)
    sum1+=abs(l-r) + 1
print(sum1)

Solution (Python):
N = int(input())
ans = set([])
for i in range(N):
    strs = [int(s) for s in input().split(' ')]
    for j in range(strs[0],strs[1]+1):
        ans.add(j)

print(len(ans))

Solution (Python):
N = int(input())
a = [list(map(int, input().split())) for i in range(N)]

ans = 0
for x in a:
  ans += x[1] - x[0] + 1
  
print(ans)

Solution (Python):
n = int(input())
seat = []
for i in range(n):
    seat.append(list(map(int, input().split())))

how = []
for i in seat:
    how.append(i[1] - i[0] + 1)

how = sum(how)
print(how)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    x = input()
    a , b = map(int,x.split())
    ans += b - a + 1
print(ans)

Solution (Python):
n=int(input())
res=0
for _ in range(n):
    l,r=map(int,input().split())
    res+=r-l+1
print(res)

Solution (Python):
if __name__ == '__main__':
    N = int(input())
    ans = 0
    for i in range(N):
        l, r = list(map(int, input().split()))
        ans += r - l + 1

    print(ans)

Solution (Python):

N = int(input())
sum = 0

for i in range (N):
    a,b = map(int,input().split())
    sum += b-a+1

print(sum)

Solution (Python):
n = int(input())
p = 0
for _ in range(n):
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)

Solution (Python):
N = int(input())
Sum = 0
for i in range(N):
    sheet = list(map(int,input().split()))
    Sum += sheet[1] - sheet[0] + 1
print(Sum)

Solution (Python):
N = int(input())
sum = 0
for n in range(N):
    a, b = [int(i) for i in input().split()]
    sum += b-a+1

print(sum)

Solution (Python):
N = int(input())

ans = 0
for i in range(N):
    l, r = map(int, input().split())
    ans += r - l + 1

print(ans)

Solution (Python):
N = input()
c = 0
for _ in xrange(N):
    l,r = map(int, raw_input().split())
    c += r - l + 1
print c

Solution (Python):
N= int(input())

L = []
R = []
for i in range(N):
	l, r= map(int, input().split())
	L.append(l)
	R.append(r)

Q=[]
P=0
for x in range(N):
    P=R[x]-L[x]+1
    Q.append(P)
    
print(sum(Q))

Solution (Python):
N = int(input())
res = 0
for _ in range(N):
    group = [int(x) for x in input().split(' ')]
    res += (group[1] - group[0]) + 1
print(res)

Solution (Python):

N = int(input())
people = 0
for i in range(N):
    l,r = map(int,input().split())
    people = people + (r - l + 1)
print(people)

Solution (Python):
N = int(input())

s = 0

for i in range(N):
    l, r = list(map(int, input().split(" ")))
    s += r - l + 1

print(s)

Solution (Python):
N=int(input())
c=0
for i in range(N):
    l,r=(int(i) for i in input().split())
    c+=r-l+1
print(c)

Solution (Python):
n=int(input())
l=[]
r=[]
p=[]
for x in range(n):
    L,R=map(int,input().split())
    l.append(L)
    r.append(R)

def hito(x):
    return r[x]-l[x]+1
for x in range(n):
    p.append(hito(x))
print(sum(p))

Solution (Python):
N = int(input())
memo = [list(map(int, input().split())) for _ in range(N)]
result = sum([(memo[i][1] - memo[i][0] + 1) for i in range(N)])
print(result)

Solution (Python):


N = int(input())
sum_visitor = 0
for i in range(N):
    input_str = input()
    nums = input_str.split(' ')
    sum_visitor += (int(nums[1]) - int(nums[0]) + 1)
print(sum_visitor)

Solution (Python):


import sys

def main(argv):
    line = sys.stdin.readline()
    while line:
        N = int(line)
        total = 0
        for i in xrange(N):
            l, r = map(lambda x: int(x), sys.stdin.readline().split(" ", 2))
            total += (r - l) + 1
        print(total)
        line = sys.stdin.readline()
        

if __name__ == "__main__":
    main(sys.argv)

Solution (Python):
def main():
    N = int(input())
    total = 0
    for _ in range(N):
        l, r = map(int, input().split())
        total += r - l + 1
    print(total)

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a = []
answer = 0
for i in range(N):
	a.append(list(map(int, input().split())))
	answer = answer + a[i][1] - a[i][0] + 1

print(answer)

Solution (Python):

import sys
if __name__ == '__main__':
    line = sys.stdin.readline()
    N = int(line)
    count = 0
    for i in range(N):
    	line = sys.stdin.readline().split(" ")
    	count += int(line[1]) - int(line[0]) + 1
    print(count)

Solution (Python):
inp = int(input())

sum = 0
for i in range(inp):
	a, b = map(int, input().split())
	sum += b - a + 1
print(sum)

Solution (Python):
N = int(input())
ans = 0

for i in range(N):
    a, b = map(int, input().split())
    ans += b-a+1

print(ans)

Solution (Python):
N = int(input())

sum_num = 0
for i in range(N):
    l, r = map(int, input().split())
    sum_num += r - l + 1

print(sum_num)

Solution (Python):
res = 0
for _ in range(int(input())):
        l, r = map(int, input().split())
        res += r-l+1
print(res)

Solution (Python):
n=int(input())
ans=0
for i in [0]*n:
    l,r=[int(x) for x in input().split()]
    ans+=r-l+1
print(ans)

Solution (Python):
a = int(input())
t = 0 
for i in range(a):
   b,c = map(int,input().split())
   if b >= c:
      t += (b - c) + 1
   else:
      t += (c - b) + 1
print(t)

Solution (Python):
N=input()
a=[]
for i in range(N):
	a.append(map(int, raw_input().split()))



sum=0
for i in range(N):
	sum+=a[i][1]-a[i][0]+1

print sum

Solution (Python):
N=int(input())
people=0
for i in range(N):
    left,right=map(int,input().split())
    number = right - left +1
    people += number
print(people)

Solution (Python):
num=int(raw_input())
output=0
for i in range(num):
    tmp=map(int, raw_input().split(" "))
    output+=tmp[1]-tmp[0]+1

print output

Solution (Python):
N = input()
ans = 0
for _ in range(N):
    l, r = map(int, raw_input().split())
    ans += r-l+1
print ans

Solution (Python):
n = int(input())

hito = 0
for i in range(n):
    lr = list(map(int,input().split()))
    hito += (lr[1] - lr[0] +1 )
    
print(hito)

Solution (Python):


import os
import sys
import math
import numpy as np


N = int(input())
seat = np.array([list(map(int, input().split())) for i in range(N)])

print(np.sum(seat[:,1] - seat[:,0]+1))

Solution (Python):
n=int(raw_input())
number=0
while n !=0:
    a ,b=map(int, raw_input().split())
    number+=b-a+1
    n-=1
print(number)

Solution (Python):
l=int(input())

n=0
for i in range(l):
    ab = input().split()
    a=int(ab[0])
    b=int(ab[1])
    n = n+b-a+1     
    
print(n)

Solution (Python):
N = int(input())
total = 0

for i in range(N):
    group = input().split()
    start, end = int(group[0]), int(group[1])
    total += end - start + 1

print(total)

Solution (Python):
s = 0
for x in range(int(input())):
	a, b = map(int, raw_input().split())
	s += (b - a)+1
print s

Solution (Python):
n = int(input())
ans = 0
for _ in range(n):
  l, r = map(int, input().split())
  ans += r - l + 1
  
print(ans)

Solution (Python):
num = int(input())
ans = 0
for a in range(num):
    temp = input().split(" ")
    for b in range(len(temp)):
        temp[b] = int(temp[b])
    ans += (temp[1] - temp[0]) + 1
print(ans)

Solution (Python):
time = int(input())
ans = 0
for i in range(time):
    now = input().split()
    ans += int(now[1]) + 1 - int(now[0])
print(ans)

Solution (Python):
N = int(input())
p = 0
for _ in range(N):
    l, r = map(int, input().split())
    p += r - l +1
print(p)

Solution (Python):
l = [0]*100005
n = int(raw_input())
for x in xrange(n):
	a = map(int,raw_input().strip().split())
	for y in xrange(a[0],a[1]+1):
		l[y] = 1
ans = 0
for x in l:
	if x == 1:
		ans += 1
print(ans)

Solution (Python):
n = int(input())
ans = 0
for _ in range(n):
    l,r = map(int,input().split())
    ans += r-l+1

print(ans)

Solution (Python):
N = int(input())
lr = [list(map(int, input().split())) for n in range(N)]

res = 0
while lr:
    tlr = lr.pop()
    res += tlr[1] - tlr[0] + 1

print(res)

Solution (Python):


N = int(input())

num = 0
for i in range(N):
    l, r = map(int, input().split(" "))

    num += r - l + 1
print(num)

Solution (Python):

"""
"""


def solve(data):
    total = 0
    for b, e in data:
        num = e - b + 1
        total += num
    return total


def main():
    N = int(input())
    data = []
    for _ in range(N):
        data.append([int(x) for x in input().split(' ')])
    result = solve(data)
    print(result)


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    N = int(input())
    LR = tuple(tuple(map(int, input().split())) for _ in range(N))

    people = 0
    for l, r in LR:
        people += r - l + 1

    print(people)

main()

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
    l,r = input().split()
    ans += int(r)-int(l)+1
print(ans)

Solution (Python):
n=int(input())
x=0
for i in range(n):
  a,b=map(int,input().split())
  x=x+b-a+1
print(x)

Solution (Python):
N = int(input())
total = 0
for i in range(N):
    l,r = map(int, input().split())
    total += (r - l + 1)
print(total)

Solution (Python):
N = int(input()) 
lis = []
for i in range(N):
    lis.append(list(map(int, input().split())))

nsum = 0
for j in range(N):
    nsum += lis[j][1] - lis[j][0] +1

print(nsum)

Solution (Python):

N = int(raw_input().rstrip())
num = 0
for i in range(N):
    s = map(int, raw_input().split())
    num += s[1] - s[0] + 1
print num

Solution (Python):

N = int(input())
x = [list(map(int, input().split())) for i in range(N)]
j1=0
j2=0
res=0
for i in x:
    res += i[1]-i[0]+1

print(res)

Solution (Python):


import sys


def main():
    count = 0
    for line in sys.stdin:
        if len(line.rstrip().split(" ")) == 1:
            continue
        start, end = map(int, line.rstrip().split(" "))
        count += end - start + 1
    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())
seat = [0 for i in range(100000+1)]
for i in range(N):
    l, r = [int(i) for i in input().split()]
    for j in range(l, r+1):
        seat[j] = 1
print(sum(seat))

Solution (Python):
N = int(input())
array = []
sum = 0

for i in range(N):
	a = list(map(int,input().split()))
	sum += (a[1] - a[0] + 1)
	


print(sum)

Solution (Python):


n = int(input())
ans = 0
for i in range(n):
    l, r = list(map(int, input().split()))
    ans += r - l + 1
print(ans)

Solution (Python):
N = int(input())
sum = 0
for i in range(N):
    i, j = list(map(int, input().split(' ')))
    sum += j - i + 1
print(sum)

Solution (Python):
def solution():
	n = int(input())
	ans = 0
	for i in range(n):
		x,y = [int(x) for x in input().split(' ')]
		ans+=y-x+1

	print(ans)

solution()

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

Solution (Python):
n = int(input())
p = 0
for _ in range(n):
    l, r = map(int, input().split())
    p += r - l + 1

print(p)

Solution (Python):
n=input()
num=0
for i in range(n):
  (a,b) = map(int,raw_input().split(' '))
  num = num + b - a + 1
print num

Solution (Python):
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=0
for i in range(n):
    [l,r]=i2()
    a+=r-l+1
print(a)

Solution (Python):

N = int(input())
ans = 0
for tmp in range(N):
    l, r = map(int, input().split())
    ans += r-l+1
print(ans)

Solution (Python):

n = int(input())

res = 0

for _ in range(n):
    l, r = list(map(int, input().split(' ')))
    res += r - l + 1

print(res)

Solution (Python):
sum=0
for i in range(int(input())):
  l,r=[int(x) for x in  input().split()]
  sum = sum + r - l + 1
print(sum)

Solution (Python):
def b():
    n = int(input())
    total = 0
    for _ in range(n):
        l, r = map(int, input().split())
        total += r - l + 1
    print(total)

b()

Solution (Python):
n=int(input())
s=0
for i in range(n):
    a,b=map(int,input().split())
    s+=b-a+1
print(s)

Solution (Python):
N = int(input())						

sum=0
for i in range(N):
	l, r = map(int, input().split())		
	sum += r - l + 1

print(sum)

Solution (Python):
N = int(input())
num = 0
for i in range(N):
    r, l = map(int, input().split())
    num = num + l - r + 1
print(num)

Solution (Python):
def spaceinput():
    return list(map(int,input().split(" ")))




N=int(input())
l=list()
for i in range(N):
    l.append(spaceinput())

sum=0
for sl in l:
    sum+= sl[1]-sl[0]+1

print(sum)

Solution (Python):
n = int(input())
a = [list(map(int, input().split())) for i in range(n)]
x = 0

for i in range(n):
    x += a[i][1]-a[i][0]+1

print(x)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    a, b = map(int, input().split())
    ans += (b - a +1)

print(ans)

Solution (Python):
n = int(input())
result = 0
for i in range(n):
  r, l = map(int, input().split())
  result += l - r + 1

print(result)

Solution (Python):
N = int(input())
cnt = 0
for i in range(N):
  l,r = map(int, input().split())
  cnt = cnt + r - l + 1
  
print(str(cnt))

Solution (Python):
n=int(raw_input())
res = 0
for i in range(n) :
    x,y = map(int,raw_input().split())
    res += y-x+1
print res

Solution (Python):
n = int(input())
res = 0
while n:
    a, b = map(int, input().split())
    res += b - a + 1
    n -= 1
print(res)

Solution (Python):
n = int(input())

num = 0
for i in range(n):
    l, r = map(int, input().split())
    num += r - l + 1

print(num)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int,input().split())
    ans += (r - l + 1)

print(ans)

Solution (Python):
N=int(raw_input())

s=0
for i in range(N):
    l,r=map(int,raw_input().split(' '))
    s+=(r-l+1)

print s

Solution (Python):
N = int(input())

count = 0
for i in range(N):
    inlist = [int(_) for _ in input().split()]
    count += inlist[1] - inlist[0] + 1

print(count)

Solution (Python):
N = int(raw_input())
answer = 0
for n in xrange(N):
  l, r = map(int, raw_input().split(' '))
  answer += r - l + 1
print answer

Solution (Python):
n = int(input())
s = n
for _ in range(n):
  a, b = map(int, input().split(" "))
  s += b - a
print(s)

Solution (Python):
N = int(input())
ret = 0
for _ in range(N):
  l,r = map(int,input().split())
  ret += r-l+1
print(ret)

Solution (Python):
n =int(input())
ans = 0
for i in range(n):
    l,r = map(int, input().split())
    ans += r-l+1
print(ans)

Solution (Python):



n = raw_input()
n = int(n)

num = 0

for i in range(n):
    lr = raw_input()
    lr = lr.split()
    l,r = map(int,lr)
    num += (r-l+1)

print num

Solution (Python):
N = int(input())
people = [list(map(int, input().split())) for i in range(N)]
ans = 0

for p in people:
    ans += (p[1] - p[0]) + 1

print(ans)

Solution (Python):
N = int(input())
a = 0
for i in range(N):
    l, r = map(int, input().split())
    a += r - l + 1
print(a)

Solution (Python):
z = 0
for _ in xrange(input()):
    (l,r) = map(int,raw_input().split(' '))
    z += r-l+1
print z