B - Theater Editorial /

Time Limit: 2 sec / Memory Limit: 256 MB

配点 : 200

問題文

joisinoお姉ちゃんは、劇場の受付を担当しています。

この劇場には、席 1 から席 100000 までの、100000 個の席があります。

彼女のメモ書きによると、今までの間に N 組の団体が来て、i 組目の団体は席 l_i から席 r_i までの連続した席に座っています。

今、劇場の席には何人座っているか求めてください。

制約

  • 1≦N≦1000
  • 1≦l_i≦r_i≦100000
  • 同じ席に複数の人が座ることはない。
  • 入力は全て整数である。

入力

入力は以下の形式で標準入力から与えられる。

N
l_1 r_1
:
l_N r_N

出力

劇場の席に座っている人数を出力せよ。


入力例 1

1
24 30

出力例 1

7

24,25,26,27,28,29,30 番の席に人が座っており、 7 人です。


入力例 2

2
6 8
3 3

出力例 2

4

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