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

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

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

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

g=0
for i in range(n):
    t=eval(input().replace(" ","-"))
    g+=1-t
print(g)

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

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

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

cnt = 0
for j in range(n):
    cnt += r[j]-l[j]+1
print(cnt)

Solution (Python):

import sys
def input(): return sys.stdin.readline().rstrip()
def mi(): return map(int, input().split())


N = int(input())

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

Solution (Python):

import sys


def solve(N: int, l: "List[int]", r: "List[int]"):
    ret = 0
    for i in range(N):
        ret += r[i] - l[i] + 1
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    l = [int()] * (N)  
    r = [int()] * (N)  
    for i in range(N):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, l, r)

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

Solution (Python):











import sys
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    ans=0
    for _ in range(N):
        l, r = MI()
        ans += r - l + 1
    print(ans)
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())
seats = []
for i in range(0, 100000):
	seats.append(False)
for i in range(0, N):
	left, right = map(int, input().split())
	for j in range(left-1, right):
		seats[j] = True
cnt = 0
for i in range(0, 100000):
	if seats[i]: cnt += 1
print(cnt)

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

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

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

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

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

Solution (Python):
N = int(input())
l = [0] * N
r = [0] * N
for i in range(N):
    l[i], r[i] = map(int, input().split())
    
cnt = 0
for i in range(N):
    cnt += r[i] - l[i] + 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())
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):
  a, b = map(int,input().split())
  c = b-a+1
  num += c
print(num)

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())
l=[]
r=[]
cnt=0
for i in range(n):
  l,r=map(int,input().split())
  if l!=r:
    cnt+=max(l,r)-min(l,r)+1
  else: cnt+=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):

import sys


def solve(N: int, l: "List[int]", r: "List[int]"):
    ans = 0
    for _l, _r in zip(l, r):
        ans += _r - _l + 1
    print(ans)
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  
    l = [int()] * (N)  
    r = [int()] * (N)  
    for i in range(N):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, l, r)


if __name__ == "__main__":
    main()

Solution (Python):
from functools import reduce
n = [reduce(lambda l, r: r - l + 1, \
     map(lambda s: int(s), input().split())) for _ in range(int(input()))]
print(sum(n))

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

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

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

print(total)

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

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

print(total)

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

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

print(total)

Solution (Python):
N = int(input())
cnt = [0] * 100005
for i in range(N):
    l,r = map(int,input().split(" "))
    cnt[r+1] -= 1
    cnt[l] += 1
ans = 0
for i in range(100004):
    cnt[i+1] += cnt[i]
    if cnt[i] > 0:
        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())
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())
    for _ in range(l, r+1):
        ans += 1
print(ans)

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

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

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

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

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

Solution (Python):

N = int(input())

ans = 0
for i in range(N):
    l,r = list(map(int,input().split(" ")))
    ans += abs(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())
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 = []
r = []
for i in range(N):
    temp_l, temp_r = input().split()
    l.append(int(temp_l))
    r.append(int(temp_r))
ans = 0
for i in range(N):
    ans += r[i] - l[i] + 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())
ans=0
for i in range(n):
  ans+=r[i]-l[i]+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())
g = 0
for _ in range(N):
    l,r = map(int,input().split())
    g += r-l+1
print(g)

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

sm=0

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


print(sm)

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

print(ans)

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

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

Solution (Python):
n=int(input())
ans=0
for i in range(n):
    ans+=~(eval(input().replace(' ','-')))+2
print(ans)

Solution (Python):
def ipt(N=0,switch=0):
    if N == 0:
        return list(map(int,input().split()))
    else:
        if switch==0:
            return [list(map(int,input().split())) for _ in range(N)]
        else:
            return [int(input()) for _ in range(N)]

N=int(input())
LR=ipt(N)
ans=0
for i in range(N):
    ans += LR[i][1] - LR[i][0] + 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())
print(sum(r[i]-l[i] for i in range(n))+n)

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

print(ans)

Solution (Python):


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

if __name__ == "__main__":
    solve()

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

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

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

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

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

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

print(sum(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())
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 _ 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):
def read_input():
    n = int(input())

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

    return n, sheets

def submit():
    n, sheets = read_input()

    watcher = 0
    for sheet in sheets:
        watcher += sheet[1] - sheet[0] + 1

    print(watcher)


if __name__ == '__main__':
    submit()

Solution (Python):
N = int(input())
def a(x):
    x = list(map(int,x.split(" ")))
    return x[1]-x[0]+1
print(sum(map(a,[input() for x in range(N)])))

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

Solution (Python):

n = int(input())
lst = [list(map(int, input().rstrip().split())) for _ in range(n)]
total = 0
for i in lst:
    total += i[1] - i[0] + 1
print(total)

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    ans = 0
    for i in range(n):
        a,b = f()
        ans += b- a+1
    
    print(ans)

solve()

Solution (Python):
N = int(input())
L = []
R = []
for i in range(N):
    l,r = map(int,input().split())
    L.append(l)
    R.append(r)
print(sum(R)-sum(L)+N)

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):
from functools import reduce
import math

def main():
    
    
    
    

    
    
    
    
    
    

    
    

    
    
    
    
    
    
    
    
    
    INF = float("inf")

    
    MOD = 10**9+7
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    N = int(input())
    l = []
    r = []
    ans = 0
    for i in range(N):
        s1,s2 = (int(_) for _ in input().split())
        ans += s2 - s1 +1

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

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

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

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

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())
l, r = map(list, zip(*(map(int, input().split()) for i in range(n))))

print(sum(r_i - l_i + 1 for l_i, r_i in zip(l, r)))

Solution (Python):

n=int(input())
ans=0
for i in range(n):
    l,r=map(int,input().split())
    if l==r:
        ans+=1
    else:
      ans= 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())
seat = []
seats_occ = 0
for i in range(N):
    x = list(map(int,input().split()))
    seat.append(x)
    
for i in range(N):
    seats_occ += (seat[i][1] - seat[i][0]) + 1
    
print(seats_occ)

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

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

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

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

import copy
import numpy as np
import random
import bisect 
import math


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

cnt = 0
for i in range(N):
    cnt += groups[i][1]-groups[i][0]+1

print(cnt)

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

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

Solution (Python):
N=int(input())
list_n=[]
for i in range(100001):
    list_n.append(False)
for i in range(N):
    l,r = map(int,input().split())
    for j in range(l-1,r):
        list_n[j]=True
        
ans=0
for i in range(100000):
    if(list_n[i]):
        ans+=1
        
print(ans)

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

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

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

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

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

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

print(ans)

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

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

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

print(num)

Solution (Python):
n = int(input())
ans = 0
for i in range(n):
    l, r = [int(item) for item 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):
import sys
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()
ans = 0
for i in range(n):
    l, r = nm()
    ans += r - l + 1
print(ans)

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

print(res)

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

Solution (Python):
_,*t=open(0);print(sum(1-eval(s.replace(' ','-'))for s in t))

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())
lr=[[int(i) for i in input().split()] for _ in range(n)]
persona=0
for i in range(n):
    persona+=lr[i][1]-lr[i][0]+1
print(persona)

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

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

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

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

print(s)

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

Solution (Python):
ans = 0

n = int(input())
for _ 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):
    l, r = map(int, input().split())
    sum += r-l+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):
from sys import stdin
n = int(stdin.readline().rstrip())
data = [list(map(int, stdin.readline().rstrip().split())) for _ in range(n)]
print(sum([l[1]-l[0]+1 for l in data]))

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):
cnt = 0

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

Solution (Python):


import itertools
import collections
import bisect

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

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

Solution (Python):


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

answer = 0

for i in range(n):
    answer += r[i] - l[i] + 1

print(answer)

Solution (Python):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007


"""
n = S()
if "9" in n:
    print("Yes")
else:
    print("No")
"""

n = I()
f = [0 for i in range(100002)]
for i in range(n):
    l,r = LI()
    f[l] += 1
    f[r+1] -= 1
ans = 0
for i in range(1,100001):
    f[i] += f[i-1]
    if f[i]:
        ans += 1
print(ans)

"""
n = I()
d = defaultdict(int)
for i in range(n):
    a = I()
    d[a] ^= 1
d = list(d.values())
print(sum(d))
"""

"""
def dfs(n,k,l,a):
    if n == 0:
        a.append(l)
    for i in range(n):
        dfs(n-1,k[:i]+k[i+1:],l+[k[i]],a)
n,m,R = LI()
r = LI()
f = [i for i in range(n)]
for i in range(R):
    r[i] -= 1
v = [[float("inf") for j in range(n)] for i in range(n)]
for i in range(n):
    v[i][i] = 0
for i in range(m):
    a,b,c = LI()
    a -= 1
    b -= 1
    v[a][b] = c
    v[b][a] = c
for k in range(n):
    for i in range(n):
        for j in range(n):
            v[i][j] = min(v[i][j],v[i][k]+v[k][j])
l = []
dfs(R,r,[],l)
ans = float("inf")
for k in l:
    d = 0
    for i in range(R-1):
        d += v[k[i]][k[i+1]]
    ans = min(ans,d)
print(ans)
"""

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

for i in range(n):
    cnt += box[i][-1] - box[i][0] + 1

print(cnt)

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

print(ans)

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

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

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

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

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

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())
sl=[]
for i in range(N):
  sl.append(list(map(int,input().split())))
sl.sort()
sl_table = [True for i in range(len(sl))]

for i in range(N):
  for j in range(min(i+1,N),N):
    if sl[j][0]-sl[i][1]>0:
      break
    sl[i]=[min(min(sl[i]),min(sl[j])),max(max(sl[i]),max(sl[j]))]
    sl_table[j]=False

print(sum((s[1]-s[0]+1)*sl_table[i] for i,s in enumerate(sl)))

Solution (Python):
import sys

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

    return ans


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

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

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

Solution (Python):
n = int(input())
lr = []
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):
    a,b = map(int,input().split())
    ans += b-a+1

print(ans)

Solution (Python):
cnt = 0

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

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

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

Solution (Python):
def theater(N: int, queries: list)->int:
    return sum(r - l + 1 for l, r in queries)


if __name__ == "__main__":
    N = int(input())
    queries = [tuple(int(s) for s in input().split()) for _ in range(N)]
    ans = theater(N, queries)
    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())
seats = [list(map(int, input().split())) for _ in range(n)]
count = 0
for l,r in seats:
    count += (r-l+1)
print(count)

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

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

Solution (Python):
N=int(input())
T=0
for i in range(N) :
  A,B=map(int,input().split())
  T=T+(B-A+1)
print(T)

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

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