欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1136A.Nastya Is Reading a Book
Nastya Is Reading a Book
After lessons Nastya decided to read a book. The book contains chapters, going one after another, so that one page of the book belongs to exactly one chapter and each chapter contains at least one page.
Yesterday evening Nastya did not manage to finish reading the book, so she marked the page with number as the first page which was not read (i.e. she read all pages from the -st to the -th).
The next day Nastya's friend Igor came and asked her, how many chapters remain to be read by Nastya? Nastya is too busy now, so she asks you to compute the number of chapters she has not completely read yet (i.e. the number of chapters she has not started to read or has finished reading somewhere in the middle).
Input
The first line contains a single integer () — the number of chapters in the book.
There are lines then. The -th of these lines contains two integers , separated by space (, ) — numbers of the first and the last pages of the -th chapter. It's guaranteed that for all , and also that every chapter contains at most pages.
The -th line contains a single integer () — the index of the marked page.
Output
Print a single integer — the number of chapters which has not been completely read so far.
Note
In the first example the book contains pages and chapters — , and . Nastya marked the -nd page, so she finished in the middle of the -st chapter. So, all chapters has not been read so far, so the answer is .
The book in the second example contains pages and chapters too, but Nastya finished reading in the middle of the -nd chapter, so that the answer is .
Samples
3
1 3
4 7
8 11
2
3
3
1 4
5 9
10 12
9
2
1
1 7
4
1
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |