/* Train of Thought:
The first response to this question is to sort the start time.
However, this will be troublesome.
I should change the angle and thinking of questions.
Sort this question by End Time
It will be much simpler */
# Include <stdio. h>
# Include <stdlib. h> // header files are required for qsort sorting.
Struct move
{
Int tis;
Int tie; // Member
} Num [110]; // use only one array, because an array contains multiple members.
Int CMP (const void * a, const void * B)
{
Return (* (move *) a). Tie-(* (move *) B). Tie;
// Because it is to sort the tie of the struct and the tie is of the int type, it adopts the fast sorting mode of the int type.
// Determine the format after return based on the type of the sorted members
}
// The above is the first-level sorting of the struct.
Int main ()
{
Int N;
Int nt, I, j;
Int sum;
While (scanf ("% d", & N), n)
{
For (I = 0; I <n; I ++)
Scanf ("% d", & num [I]. Tis, & num [I]. Tie );
Qsort (Num, N, sizeof (Num [0]), CMP );
Sum = 1;
Nt = num [0]. Tie;
For (I = 1; I <n; I ++)
{
If (Num [I]. Tis> = Nt & num [I]. Tie> NT)
{
Sum ++;
Nt = num [I]. Tie;
}
}
Printf ("% d \ n", sum );
}
Return 0;
}