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())
l = list()
r = list()
for i in range(n):
    a,b = map(int, input().split())
    l.append(a)
    r.append(b)
count = 0
for i in range(n):
    count += r[i] - l[i] + 1
print(count)

Solution (Python):
n = int(input())
lr = []
ans = 0
for i in range(n):
    lr.append(list(map(int, input().split())))
    ans += lr[i][1] - lr[i][0] + 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):
n = int(input())

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

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())
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 _ in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

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

print(cnt)

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

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())

total=0

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

print(total)

Solution (Python):



N = int(input().strip())


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

print(sum)

Solution (Python):
n=int(input())
a=n
for i in range(n):
  a-=eval(input().replace(" ","-"))
print(a)

Solution (Python):
n = int(input())
l = [list(map(int, input().strip().split())) for i in range(n)]
cnt = 0
for i in l:
    cnt += len([j for j in range(i[0], i[1]+1)])
print(cnt)

Solution (Python):
ans=0
for i in range(int(input())):
  l,r=map(int,input().split())
  ans+=r-l+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):
def main():
    groups = int(input())
    answer = 0
    for _ in range(groups):
        reserved = list(map(int, input().split()))
        answer += reserved[1] - reserved[0] + 1
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
n =int(input())
s = []
for i in range(n):
    l,r = map(int,input().split())
    s += [r-l+1]
print(sum(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):
def resolve():
    N = int(input())
    res = 0
    for _ in range(N):
        l, r = [int(x) for x in input().split()]
        res += r - l + 1
    return res

if __name__ == '__main__':
    print(resolve())

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())

people = 0

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

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

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())
S = 0
for _ in range(N):
    l,r = map(int,input().split())
    S += r-l+1
print(S)

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

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

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

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

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):
def theater(n , lt):

    ans = 0

    for i in range(n):
        ans += (lt[i][1] - lt[i][0]) + 1

    return ans

def main():
    n = int(input())
    lt = [list(map(int , input().split())) for i in range(n)]
    print(theater(n , lt))

if __name__ == '__main__':
    main()

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=n
for i in range(n):
    l,r=map(int,input().split())
    ans+=r-l
print(ans)

Solution (Python):
N=int(input())
L = [None]*N
for i in range(N):
    L[i] = list(map(int,input().split()))
ans = 0
for i in range(N):
    ans+=(L[i][1]-L[i][0]+1)

print(ans)

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())
res = 0
for i in range(n):
  a,b=map(int,input().split())
  res+=b-a+1
print(res)

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

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

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

nop = [s[-1] - s[0] + 1 for s in seats]
r = sum(nop)

print(r)

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())
min=[]
max=[]
mem=0
for i in range(n):
    min1,max1=[int(i) for i in input().split()]
    min.append(min1)
    max.append(max1)
    mem+=max[i]-min[i]+1
print(mem)

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):
    l, r = map(int, input().split())
    ans += r-l+1
print(ans)

Solution (Python):


import math


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


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np
N = int(input())
l,r = np.array([0]*N),np.array([0]*N)
for i in range(N):
    l[i],r[i] = map(int, input().split())
rl = r-l+1
print(sum(rl))

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

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

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

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

print(ans)

Solution (Python):
def main(n, l_r):
    ans = 0

    for l, r in l_r:
        ans += r - (l - 1)

    print(ans)


if __name__ == "__main__":
    n = int(input())
    l_r = [list(map(int, input().split())) for _ in range(n)]

    main(n, l_r)

Solution (Python):

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

Solution (Python):
times = int(input())
i = 0
nums = []
while i < times:
    nums.append(list(map(int, input().split())))
    i += 1

count = 0
for num in nums:
    count += num[1] - num[0] + 1

print(count)

Solution (Python):
def theater():
    total = 0
    try:
        N = int(input())
        l_r = (list(map(lambda x: int(x), input().split(' '))) for elem in range(N))
    except:
        return
    if not (1 <= N and N <= 1000): return
    for l, r in l_r:
        if 1 <= l and l <= 100000 or 1 <= r and r <= 100000:
            total += r - l + 1
        else:
            return
    print(total)

if __name__ == "__main__":
    theater()

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())
ans=0

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

print(ans)

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

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

for i in range(N):
    ans += (abs(r[i]-l[i])+1)

if ans<=10**5:
    print(ans)
else:
    print(10**5)

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):
	s1,s2=map(int,input().split())
	ans+=s2-s1+1
print(ans)

Solution (Python):
n = int(input())
li = []
count = 0
for i in range(n):
    lr = list(map(int,input().split()))
    li.append(lr)
for j in range(n):
    count += li[j][1] - li[j][0] + 1
print(count)

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())
l = 0
for i in range(n):
    a,b = map(int,input().split())
    l += (b-a)+1
print(l)

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

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

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):


def intinput():
    return int(input())

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

def splitintinput():
    return map(int,input().split())

N = intinput()
ans = 0
for i in range(N):
    a,b = splitintinput()
    ans += b-a+1

print(ans)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

N = int(input())

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

print(answer)

Solution (Python):
import sys
input = sys.stdin.buffer.readline

N = int(input())
LR = [list(map(int, input().split())) for _ in range(N)]

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

print(answer)

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

Solution (Python):
"""
author : halo2halo
date : 30, Jan, 2020
"""

import sys


import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
LR= [map(int, readline().split()) for _ in range(N)]


ans=0
for i,j in LR:
    ans+=j-i+1
    

print(ans)

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

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

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

print(result)

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())
res = 0
for _ in range(N):
    r, l = map(int, input().split())
    res += l - r + 1
print(res)

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

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

print(count)

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

Solution (Python):
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
sum = 0

for i in range(n):
    sum += l[i][1] - l[i][0] + 1
print(sum)

Solution (Python):
print(sum(1-eval(input().replace(" ","-")) for _ in range(int(input()))))

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ans=0
    for i in range(n):
        l,r=INTM()
        ans+=r-l+1
    print(ans)
if __name__ == '__main__':
    do()

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 _ in range(n):
    l, r = map(int, input().split())
    count = r - l + 1
    ans += count

print(ans)

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

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

for i in range(N):
    l, r = X[i]
    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):
n = int(input())

s = 0

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

print(s)

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

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

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):
import numpy as np

N = int(input())
C = np.array([input().split() for i in range(N)])
sm = 0
for i in range(N):
    sm += int(C[i, 1])-int(C[i, 0])+1

print(sm)

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
L = []
ans = 0
for i in range(n):
    a, b = LIST()
    ans += b - a + 1
print(ans)

Solution (Python):
print(sum(r-l+1 for l, r in [tuple(map(int, input().split())) for _ in range(int(input()))]))

Solution (Python):
ans=0
for _ in range(int(input())):
  ans+=eval("-"+input().replace(" ","+"))+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):
n=int(input())
x=0
for i in range(n):
   l,r=map(int,input().split())
   x+=(r-l+1)
print(x)

Solution (Python):
import sys
input = sys.stdin.readline
sum = 0
N = int(input())
for i in range(N) :
    l,r = [int(i) for i in input().split()]
    sum += abs(r-l) +1
print(sum)

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())

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

print(ans)

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

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

print(people)

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
lr = [LIST() for _ in range(N)]

ans = 0

for l, r in lr:
	ans += r-l+1

print(ans)

Solution (Python):


import numpy as np

n=int(input())
ans=0
for a_ 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 _ in range(N)]

ans = 0
for i in range(N):
  ans += lr[i][1] - lr[i][0] + 1

print(ans)

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

s = 0
for _ in range(N):
    a, b = map(int, input().split())
    s += b + 1 - a
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())


l = []
s = 0

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

Solution (Python):
n = int(input())
memo = []
for i in range(n):
   tmp = [int(x) for x in input().split()]
   memo.append(tmp)

seat = [a[1] - a[0] + 1 for a in memo]
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 _ in range(int(input())):
  l, r = map(int, input().split())
  ans += r-l+1
print(ans)

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

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

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

print(cnt)

Solution (Python):
import sys
input = sys.stdin.readline
N = int(input())
A = []
for _ in range(N):
    A.append([int(x) for x in input().split()])
ans = 0
for i in A:
    ans += i[1] - i[0] + 1
print(ans)

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

res = 0

for i in range(n):
    res += s[i][1] - s[i][0] +1
    
print(res)

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

Solution (Python):
n=int(input())
s = [tuple(map(int,input().split(" "))) for i in range(n)]
ans = 0
for i in s:
    ans += i[1]-i[0]+1
print(ans)

Solution (Python):
print(sum(1 - eval(input().replace(' ', '-')) for _ in range(int(input()))))

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

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())
LR=[list(map(int,input().split())) for _ in range(N)]
ans=0
for lr in LR:
     ans+=lr[-1]-lr[0]+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())

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

Solution (Python):


n = int(input())

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

print(ans)

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

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())
x = [list(map(int, input().split())) for _ in range(n)]
p = 0

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

print(p)

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):
sum=0
for i in range(int(input())):
  a,b=map(int,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 = int(input())
people = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in people:
    ans += i[1] - i[0] + 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):
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())
x = 0

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

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):
    l,r=map(int,input().split())
    ans += r-l+1
print(ans)

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):

 
import math
import itertools
import sys
import copy
 



N = int(input())

sum = 0
for _ in range(N) :
  L, R = map(int, input().split())
  sum += R-(L-1)

print (sum)

Solution (Python):
print(sum(1-eval(input().replace(' ', '-')) for _ in range(int(input()))))

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())
suma = 0
for i in range(N):
    a,b = map(int,input().split())
    suma += b-a+1
print(suma)

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

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

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

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

Solution (Python):
import sys
import numpy as np

n = int(sys.stdin.readline().rstrip())
l, r = np.array(sys.stdin.read().split(), dtype=np.int64).reshape(n, 2).T

def main():
    
    return np.sum(r - l + 1)

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
import math

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

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

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 _ in range(n):
    l, r = map(int, input().split())
    ans += r-l+1
print(ans)

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

sum = 0
for _ in range(n):
    l, r = map(int,sys.stdin.readline().split())
    sum += r - l + 1

print(sum)

Solution (Python):
a=int(input())
b=[list(map(int,input().split()))for i in range(a)]
sum=0
for i in range(a):
  sum+=b[i][-1]-b[i][0]+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=int(input())
count=0
for i in range(n):
    l,n=[int(i) for i in input().split()]
    count+=n-l+1
print(count)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = map(int, input().split())
    ans += (abs(l - r) + 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):
n = int(input())
lr = [list(map(int, input().split())) for _ in range(n)]

ans = 0
for i in range(n):
    ans += lr[i][1] - lr[i][0] + 1
print(ans)

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

ans = 0
for i in range(n):
    ans += R[i] - L[i] + 1

print(ans)

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

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 _ in range(n):
    l, r = map(int, input().split())
    ans += r - l + 1
print(ans)

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

l = [[int(i) for i in input().split()] for _ in range(n)]

ans = 0
for i in l:
    ans += i[1] - i[0] + 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,a=int(input()),0
for i in range(n):
    b,c=map(int,input().split())
    a+=c-b
print(a+n)

Solution (Python):

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

ans = 0
for i in range(N):
    ans += a[i][1] - a[i][0] + 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):
n = int(input())
l = [list(map(int, input().split())) for _ in range(n)]
sum = 0
for i in range(n):
    sum += l[i][1] - l[i][0] + 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):
c=0
N=int(input())
for i in range(N):
  A=list(map(int, input().split()))
  c+=A[1]-A[0]+1
print(c)

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):
    l,r = map(int,input().split())
    ans += r-l+1

print(ans)

Solution (Python):
n = int(input())
chair = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
  left = chair[i][0]
  right = chair[i][1]
  ans += right - left + 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())
chair = [list(map(int,input().split())) for _ in range(n)]
ans = 0
for i in range(n):
  left = chair[i][0]
  right = chair[i][1]
  ans += right - left + 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):
N=int(input())
m=0
for i in range(N):
    l,r=(int(x) for x in input().split())
    m+=(r-l+1)

print(m)

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())
ls_lr = [[int(_) for _ in input().split()] for _ in range(n)]

ans = 0

for i in range(n):
    ans += ls_lr[i][1] - ls_lr[i][0] + 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())
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())
c = 0
for i in range(n):
    a,b = map(int, input().split())
    c += b-a+1
print(c)

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

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

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

l=[list(map(int,input().split())) for i in range(n)]

test = 0

for i in range(n):
	test = l[i][1]-l[i][0]+1 + test

print(test)

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n=int(input())
    ans=0
    for _ in range(n):
        l,r=MI()
        ans+=r-l+1
    print(ans)
main()

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

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

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())
S = 0

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

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

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())
ans = 0
for i in range(N):
    L,R = (int(i) for i in 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):
n = int(input())
s = list([list(map(int, input().split())) for i in range(n)])
p = 0
for i in s:
        p += i[1] - i[0] + 1
print(p)

Solution (Python):
import numpy as np

N=int(input())
S=np.zeros((100000,),np.int) 

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

    if r<len(S): 
        S[r]+=-1

Scum=np.cumsum(S) 
print((Scum>0).sum())

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

Solution (Python):
N = int(input())
new = []
for _ in range(N):
  a,b = map(int,input().split())
  t = abs(a-b)+1
  new.append(t)
print(sum(new))

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):
from sys import stdin
from itertools import accumulate

n = int(stdin.readline().rstrip())
li = [list(map(int,stdin.readline().rstrip().split())) for _ in range(n)]

point = 0

for i in li:
    point += i[1]-i[0]+1

print(point)

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
    l,r = map(int,input().split())
    num = r-l+1
    ans += num
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)