logo AlgoBeat OnlineJudge
登录 注册

#209281. [EC Final 2022] Magic

内存限制:16 MiB 时间限制:3000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

输入格式

The first line contains an integer ().

The -th line of the next lines contains a pair of integers (). It is guaranteed that all the integers, , are distinct.

输出格式

Output one integer representing the answer in one line.

样例

样例输入 1

5
2 3
6 7
1 9
5 10
4 8

样例输出 1

9