Problem description

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 pi people living in it and the room can accommodate qi people in total (pi ≤ qi). Your task is to count how many rooms has free place for both George and Alex.

Input

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 pi and qi (0 ≤ pi ≤ qi ≤ 100) — the number of people who already live in the i-th room and the room's capacity.

Output

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

Examples

Input

3
1 1
2 2
3 3

Output

0

Input

3
1 10
0 10
10 10

Output

2
解题思路:统计房间内剩余人数不小于2的房间总数(两个人住在同一间),水过!
AC代码:
 #include<bits/stdc++.h>
using namespace std;
int main(){
int n,p,q,num=;
cin>>n;
while(n--){
cin>>p>>q;
if(q-p>=)num++;
}
cout<<num<<endl;
return ;
}

最新文章

  1. JS命名空间
  2. Nagios
  3. java BigDecimal add 等方法遇到的问题
  4. Velocity资源
  5. Android 获取SDCard上图片和视频的缩略图
  6. (转)iPhone 判断UITableView 滚动到底部
  7. static_cast
  8. 用Winrar批量解压缩有密码文件方法,只需输入一次密码
  9. [笔记]ACM笔记 - 利用FFT求卷积(求多项式乘法)
  10. 去掉iframe默认滚动条后影响正常滚动以及js解决高度自适应。
  11. Unreal Engine 4(虚幻UE4)GameplayAbilities 插件入门教程(三)技能标签(Ability Tags)
  12. 移动端布局:视口viewport的理解
  13. Python3之turtle模块的使用
  14. 【Oracle】BLOB
  15. HDU 2256 Problem of Precision (矩阵乘法)
  16. 关于Cocos2d-x运行项目时弹框崩溃的解决
  17. wampserver中php版本的升级
  18. Linux中系统日志
  19. [BZOJ4237]稻草人(CDQ分治)
  20. Python引用多个模块,调用模块中的函数时,要注意的地方

热门文章

  1. linux挂载ntfs格式的U盘
  2. 用VS Code Debug Python
  3. NW.js构建PC收银端安装程序的指南
  4. inherit 关键字使得元素获取其父元素的计算值
  5. 连接mysql时遇到的问题
  6. Codeforces 805A/B/C
  7. mysql 的load data infile
  8. K - Transformation
  9. Spring bean生命周期(一)
  10. int*与(int*)的差别