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

print(c)

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

Solution (Python):
import math

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

def ii():
    return int(input())

def main():
    N = ii()
    ans = 0
    for i in range(N):
        l, r = mi()
        ans += r-l+1
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
c = 0
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())
    t=r-l+1
    ans+=t
print(ans)

Solution (Python):
N = int(input())
seat = [0]*100000
for i in range(N):
    a,b = map(int,list(input().split()))
    for j in range(a,b+1):
        seat[j-1] = 1
print(sum(seat))

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

summ = 0

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

print(summ)

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

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

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

print (ans)

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

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

total = 0
for i in range(n):
  s,e = list(map(int,input().strip().split()))
  total += (e-s+1)

print(total)

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

Solution (Python):
N = int(input())
a = []

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

print(sum(a))

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

Solution (Python):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

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):
print(sum(1-eval(input().replace(" ","-")) for i in range(int(input()))))

Solution (Python):
import sys

input = sys.stdin.readline


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

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())
n=[list(map(int,input().split())) for _ in range(N)]
print(sum([max(i)-min(i)+1 for i in n]))

Solution (Python):
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

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

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

Solution (Python):
n=int(input())
l=[]
for i in range(n):
    s,t=map(int,input().split())
    l.append(t-s+1)
print(sum(l))

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

Solution (Python):
def sumnumber(N) : 
  sum = 0
  for i in range(N) : 
    l , r = tuple(map(int, input().split()))
    sum += (r - l) + 1
    
  return sum


N = int(input())

print(sumnumber(N))

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

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

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

Solution (Python):
def resolve():
    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)
resolve()

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

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

print(person)

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

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



if __name__ == '__main__':
    main()

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



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

Solution (Python):



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

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

Solution (Python):
import sys

def IS(): return sys.stdin.readline().rstrip()
def II(): return int(IS())
def MII(): return list(map(int, IS().split()))
def MIIZ(): return list(map(lambda x: x-1, MII()))

def main():
    n = II()
    cnt = 0
    for _ in range(n):
        l, r = MII()
        cnt += r-l+1
    print(cnt)

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

if __name__ == '__main__':
    a = int(input())
    count = 0

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

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

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

sa =0
ea = 0

for i in range(n):
    sa +=ab[i][0]
    ea +=ab[i][1]
    
print(ea-sa+n)

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

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

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


import sys






























def main():
    mod = 1000000007                
    inf = float('inf')              
    
    sys.setrecursionlimit(10**6)    
    def input(): return sys.stdin.readline().rstrip()
    def ii():    return int(input())
    def mi():    return map(int, input().split())
    def mi_0():  return map(lambda x: int(x)-1, input().split())
    def lmi():   return list(map(int, input().split()))
    def lmi_0(): return list(map(lambda x: int(x)-1, input().split()))
    def li():    return list(input())
    
    
    n = ii()
    ans = 0
    for _ in range(n):
        l, r = mi()
        ans += (r - l + 1) 
    print(ans)


if __name__ == "__main__":
    main()

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

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

Solution (Python):
def solve():
    ans = 0
    N = int(input())
    for i in range(N):
        x,y = map(int, input().split())
        ans += y-x+1
    return ans
print(solve())

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=[]
tmp=0
for i in range(N):
    l.append(list(map(int,input().split())))
for i in range(N):
    tmp+=abs(l[i][0]-l[i][1])+1
print(tmp)

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

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

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

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

ans = 0
for cs in c_list:
    ans += abs((cs[1]+1) - cs[0])

print(ans)

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

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):
n = int(input())

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

ans = 0

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

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

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

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())
l = []
la = l.append
for _ in range(n): l.append(list(map(int, input().split())))
l = list(map(lambda x: x[1] - x[0] + 1, l))
print(sum(l))

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

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

print(ans)

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

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

sum=0
for i in range(int(len(list)/2)):
    sum+=list[2*i+1]-list[2*i]+1
print(sum)

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

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())

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

    print(res)


if __name__ == '__main__':
    resolve()

Solution (Python):
import sys
import math
import bisect

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

if __name__ == "__main__":
    main()

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

Solution (Python):
n = int(input())
lr=[list(map(int, input().split())) for i 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())
m = 0

for _ in range(n):
    a,b = map(int, input().split())
    m += b-a+1

print(m)

Solution (Python):

"""
Created on Thu May 14 11:38:56 2020

@author: shinba
"""

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 l,r in lr:
    ans += r - l +1
print(ans)

Solution (Python):

import sys
def input(): return sys.stdin.readline().strip()

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

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

for lr in LR:
  cnt += lr[1] + 1 - lr[0]
print(cnt)

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

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)]
L2 = [l[1] - (l[0] -1) for l in L]
print(sum(L2))

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

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

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


if __name__ == "__main__":
    main()

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

Solution (Python):
n = int(input())
seat_list = [list(map(int,input().split())) for nesya in range(n)]
c = 0
for hoge in seat_list:
  c += (hoge[1]-hoge[0]+1)
print(c)

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

seat = []
for i in range(N):
  a = s[i][1]-s[i][0]+1
  seat.append(a)

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):
import sys
import math
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 = [[int(i) for i in input().split()] for i in range(N)]

ans = 0
for n in L:
    ans += n[1] - n[0] + 1

print(ans)

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

Solution (Python):

import sys
import math
from bisect import bisect_left, bisect_right, insort_left, insort_right
from collections import defaultdict, deque, Counter
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from heapq import heappop, heappush
from itertools import accumulate, groupby, product, permutations, combinations, combinations_with_replacement
from math import ceil, floor, factorial, log, sqrt, sin, cos
from operator import itemgetter
from string import ascii_lowercase, ascii_uppercase, digits
sys.setrecursionlimit(10**7)
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]
INF = float('inf')
MOD = 10 ** 9 + 7
PI = math.pi

N = ri()
ans = 0
for i in range(N):
    l, r = ri_()
    ans += r - l + 1
print(ans)

Solution (Python):
N = int(input())
LR = [[int(x) for x in input().split()] for _ in range(N)]

cnt = 0
for l, r in LR:
    cnt += r - l + 1
print(cnt)

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

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

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

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):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7


n=I()
ans=0
for i in range(n):
    a,b=MI()
    ans+=b-a+1
print(ans)

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

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

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

Solution (Python):
def resolve():
	n = int(input())
	ans = 0
	for _ in range(n):
		s, e = map(int, input().split())
		ans += e - s + 1
	print(ans)
resolve()

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

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 accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import numpy as np

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

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

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

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

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

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

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

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

Solution (Python):
size = int(input())
ans = 0
for _ in range(size):
    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())

ans = 0

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

Solution (Python):
N=int(input())
l_r=[]
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,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 one in lr:
    ans += one[1] - one[0] + 1
print(ans)

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

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):
def resolve():
    N = int(input())
    LR = [list(map(int, input().split())) for i in range(N)]
    cnt = 0
    for i in range(N):
        cnt += LR[i][1] - LR[i][0] + 1
    print(cnt)

            

if '__main__' == __name__:
    resolve()

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

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

Solution (Python):

















import sys
sys.setrecursionlimit(10000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def main():
    n = int(input())
    LIST = [0] * 100001
    for i in range(n):
        l,r = readInts()
        l -=1
        
        LIST[l] +=1
        LIST[r] -=1
    
    for i in range(1,100001):
        LIST[i] += LIST[i-1]
    cnt = 0
    for i in range(100001):
        if LIST[i] > 0:
            cnt += 1
    
    print(cnt)
if __name__ == '__main__':
  main()

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

Solution (Python):
import sys

def solve():
    input = sys.stdin.readline
    N = int(input())
    seat =  0
    for _ in range(N):
        l, r = map(int, input().split())
        seat += r - l + 1
    print(seat)
        

    return 0

if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
LR = [tuple(map(int,input().split())) for i 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())
seat = np.zeros(1000000, dtype=int)
L, R = np.array([input().split() for _ in range(N)], dtype=int).T

np.add.at(seat, L, 1)
np.add.at(seat, R+1, -1)
np.cumsum(seat, out=seat)
print(seat.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())
sum = 0
for i in range(n):
    l,r = map(int, input().split())
    sum += r+1-l
print(sum)

Solution (Python):
def main():
    import sys
    input = sys.stdin.buffer.readline
    N = int(input())
    seats = [0]*(10**5+2)
    LR = [[int(i) for i in input().split()] for j in range(N)]
    for li, ri in LR:
        seats[li] += 1
        seats[ri+1] -= 1
    from itertools import accumulate
    S = list(accumulate(seats))
    print(sum(S))


if __name__ == '__main__':
    main()

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

Solution (Python):


n=int(input())
lr=[tuple(map(int,input().split())) for _ in range(n)]
ans=0
for l,r in lr:
    ans+=r-l+1
print(ans)

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

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

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