By Kay Akashi
In the Music Centre, there is only one piano practice room. There are time slots in a single day available for the piano practice room.
One person is permitted to book several time slots in a day. The rule for booking is that, one firstly chooses consecutive time slots, and he/she can use practice rooms during those time slots where there's no preexisting booking.
Students and teaching staff love playing the piano, and today people are trying to book piano rooms. It is known that -th person would like to book a room between -th time slot and -th time slot inclusive.
Your task is to output the number of time slots in which the practice room is vacant.
Note that, -th person can make bookings earlier than -th person does .
, .
.
.
The first line of input contains two integers, and . Following are lines -th of which contains two integers and .
Output the answer.
5 2
1 2
4 5
1
Time slots and are booked by the first person. Time slots and are booked by the second person. The only remaining vacant time slot is the time slot , so the answer is .
6 3
1 4
2 5
6 6
0
Time slots , , , and are booked by the first person. Time slot is booked by the second person. Time slot is booked by the third person. Because there's no single time slot available for pianists, the answer is .