AtCoder Beginner Contest 073
B
Theater
AtCoder
⌀ 0
原题
← AC →
翻译中…

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.

翻译中…

样例

Input #1
1
24 30
Output #1
7
There are $7$ people, sitting at Seat $24,25,26,27,28,29$ and $30$.
Input #2
2
6 8
3 3
Output #2
4
题目信息
题号
abc073_b
时间限制
2 s
内存限制
256 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。