Warning: Unusual memory limit!
You are given a sequence . Initially, all numbers are zero.
There are operations. The -th operation is represented by two integers (), which assigns to . It is guaranteed that all the integers, , are distinct.
You need to perform each operation exactly once, in arbitrary order.
You want to maximize the number of such that after all operations. Output the maximum number.