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):
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

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

resolve()

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

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 k 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 li, ri in lr:
    ans += (ri - li + 1)

print(ans)

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

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(N):
        l,r=MI()
        ans+=(r-l)+1
        
    print(ans)

main()

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

if __name__ == "__main__":
  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())
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 _ in [0]*n:
  d,s=map(int,input().split())
  a+=s-d+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())
x= 0
for i in range(n):
  l,r=map(int,input().split())
  x+=r-l+1

print(x)

Solution (Python):
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math
import functools

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

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

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

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

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

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):
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())
n_list = []
for _ in range(n):
  s,t = map(int,input().split())
  n_list.append(abs(s-t) +1)
  
print(sum(n_list))

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

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

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

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

ans = set(ans)

print(len(ans))

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

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

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

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):
icase=0
if icase==0:
    n=int(input())
    ncnt=0
    for i in range(n):
        li,ri=map(int,input().split())
        ncnt=ncnt+ri-li+1
    print(ncnt)

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
lr = [list(map(int, readline().split())) for i in range(n)]
for l, r in lr:
    n += r - l
print(n)

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

read = sys.stdin.read

n = int(input())
p = np.array(read().split(), dtype=np.int64).reshape(-1,2)

ans = np.sum((p[:,1]-p[:,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 _ 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,n= map(int, input().split())
    ans=ans+n-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):
def main():
    N = int(input())
    sheet = 0
    for i in range(N):
        l, r = map(int, input().split())
        sheet += (r-l) + 1
    print(sheet)
main()

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())
seat = []
for i in range(N):
    seat.append(input().split())

con = 0
for j in range(N):
    con += int(seat[j][1]) - int(seat[j][0]) + 1

print(con)

Solution (Python):

n = int(input())
groups = [[int(s) for s in input().split()] for _ in range(n)]
members = [groups[i][1] - groups[i][0] + 1 for i in range(n)]
print(sum(members))

Solution (Python):
n = int(input())
l = []
r = []

for i in range(n):
    a,b = map(int,input().split())
    l.append(a)
    r.append(b)
    
ans = 0
for i in range(n):
    ans +=r[i] - l[i] + 1
    
print(ans)

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

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

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

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


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

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

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

ans=0

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

print(ans)

Solution (Python):

url = "https://atcoder.jp//contests/abc073/tasks/abc073_b"

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

    count = 0
    for li in t:
        count += (li[1] - li[0]) + 1
    print(count)


if __name__ == '__main__':
    main()

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

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

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

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

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

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

ans = 0
for _ in range(N):
    x,y = map(int,input().split())
    ans += abs(x-y) + 1
print(ans)

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

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

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

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

Solution (Python):
N = int(input())
ans = 0
for _ in range(N):
    li, ri = map(int, input().split())
    ans += (ri - li + 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, *s = map(int, open(0).read().split())
print(sum(s[i+1]-s[i]+1 for i in range(0, n*2, 2)))

Solution (Python):
import io
import math

nancy = int(input())
sam = 0

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

print(sam)

Solution (Python):
a = 0
for i in range(int(input())):a -= eval(input().replace(' ', '-'))-1
print(a)

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

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

Solution (Python):

import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None

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

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

print(d)

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

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

print(ans)

Solution (Python):



import queue 








mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

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

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

sum=0

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

print(sum)

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

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

for i in range(n):
    ans = ans + T[i][1] - T[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):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
ans = 0
for i in range(n):
    l,r = iim()
    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())

tmp = [[int(j) for j in input().split()] for i in range(n)]

ans = sum([i[1]-i[0]+1 for i in tmp])
print(ans)

Solution (Python):
import operator

n = int(input())

tmp = [[int(j) for j in input().split()] for i in range(n)]

ans = sum([operator.sub(i[1],i[0])+1 for i in tmp])
print(ans)

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

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

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

for _ in range(N):
  b, e = map(int, input().split())
  sum += abs(e - b) + 1

print(sum)

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

print(ans)

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

Solution (Python):


import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

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

Solution (Python):

import sys
try:
    from typing import List
except ImportError:
    pass


def solve(N: int, l: "List[int]", r: "List[int]"):
    print(sum(ri - li + 1 for li, ri in zip(l, r)))


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

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

print(customer)

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

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

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

Solution (Python):
a = int(input())
c = 0
for i in range(a):
  z=list(map(int, input().split()))
  c+=max(z)-min(z)+1
print(c)

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

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

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

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

Solution (Python):
n = int(input())
lr = []
for _ in range(n):
    a = [int(x) for x in input().split()]
    lr.append(a)

ans = 0

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

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

while i < N:
    a = input().split()
    ans += int(a[1]) - int(a[0]) +1
    i = i + 1
print(ans)

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

Solution (Python):
n = int(input().strip())
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 l in range(N):
    a, b = [int(i) for i in input().split()]
    cnt += abs(b-a) + 1

print(cnt)

Solution (Python):

def main():
    import sys
    
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    
    from itertools import combinations, permutations
    
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    

    

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

if __name__ == '__main__':
    main()

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








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


resolve()

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

Solution (Python):
N=int(input())
answers=[]
for a in range(N):
    l,r=input().split()
    answer=int(r)-int(l)+1
    answers.append(answer)
print(sum(answers))

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

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

Solution (Python):
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    ret = 0
    for n in range(N):
        l, r = list(map(int, sys.stdin.readline().split()))
        ret += r - l + 1

    print(ret)


if __name__ == '__main__':
    main()

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

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

print(cnt)

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

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

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

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
m = [stdin.readline().rstrip().split() for _ in range(n)]
ans = 0
for mi in m:
    ans += int(mi[1]) + 1 - int(mi[0])

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

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

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

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

print(sum)

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

N = int(input())

seat = []
for _ in range(N):
    l, r = map(int, input().split())
    for x in range(l, r+1):
        seat.append(x)
print(len(seat))

Solution (Python):


n = int(input().rstrip())

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

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

print(sum(r))

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

print(ans)

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

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

Solution (Python):

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    ans=0
    for i in range(N):
        l,r=MI()
        ans+=r-l+1
    print(ans)
        

main()