|
Лимит времени 1000/1000/1000/1000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Problem description
Zambak programming workshop offers N (1 ≤ N ≤ 50000) seminars to the programmers. The workshop start at time 0 and ends at time T (1 ≤ T ≤ 1000000). The seminars are given in different halls, thus some of the seminars may go on at the same time in different places. As an enthusiastic programmer you want to participate as many seminars as possible. Make a program that calculates at most how many seminars you can take at the workshop. You cannot take two seminars if they are given at the same time. If a seminar starts just after ending another seminar, you can take them both.
Input
The first line contains two integers N and T. The each of the following N lines represents starting and ending times of a seminar with two integers.
Output
Output contains an integer representing maximum number of the seminars you can take.
Example
| stdin |
stdout |
8 10
4 6
2 5
8 9
0 4
1 3
7 9
8 10
6 7
|
4 |
Для отправки решений необходимо выполнить вход.
|