302423: CF467A. George and Accommodation

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

George and Accommodation

题意翻译

一共有 _n_ 间房间(1<=n<=100),第 _i_ 个房间里有 _pi_ 个人,第 _i_ 个房间内总共可以住 _qi_ 个人。 给定 _n_ 和对应的 _pi、qi_ ,问有几个房间至少还有2个空位。

题目描述

George has recently entered the BSUCP (Berland State University for Cool Programmers). George has a friend Alex who has also entered the university. Now they are moving into a dormitory. George and Alex want to live in the same room. The dormitory has $ n $ rooms in total. At the moment the $ i $ -th room has $ p_{i} $ people living in it and the room can accommodate $ q_{i} $ people in total ( $ p_{i}<=q_{i} $ ). Your task is to count how many rooms has free place for both George and Alex.

输入输出格式

输入格式


The first line contains a single integer $ n $ $ (1<=n<=100) $ — the number of rooms. The $ i $ -th of the next $ n $ lines contains two integers $ p_{i} $ and $ q_{i} $ $ (0<=p_{i}<=q_{i}<=100) $ — the number of people who already live in the $ i $ -th room and the room's capacity.

输出格式


Print a single integer — the number of rooms where George and Alex can move in.

输入输出样例

输入样例 #1

3
1 1
2 2
3 3

输出样例 #1

0

输入样例 #2

3
1 10
0 10
10 10

输出样例 #2

2

Input

题意翻译

一共有 _n_ 间房间(1<=n<=100),第 _i_ 个房间里有 _pi_ 个人,第 _i_ 个房间内总共可以住 _qi_ 个人。 给定 _n_ 和对应的 _pi、qi_ ,问有几个房间至少还有2个空位。

加入题单

上一题 下一题 算法标签: