QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 1024 MB 満点: 100 ハック可能 ✓

#10734. 奈龙总是撒谎

統計

Grammy 到达了一个居住着神话生物的星球,其中包括一种被称为 Nailoong 的生物。通过交流,她发现了两条规则:

  • Nailoong 总是撒谎。
  • 所有其他生物可能说真话,也可能撒谎。

星球上有 $n$ 个生物。第 $i$ 个生物声称:“编号为 $a_i$ 的生物是 Nailoong。”

请确定在这些规则下,这些生物中可能存在的 Nailoong 的最大数量。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 10^5$)。

第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le n$),其中第 $i$ 个生物声称第 $a_i$ 个生物是 Nailoong。

输出格式

输出一个整数,表示在这些规则下,这些生物中可能存在的 Nailoong 的最大数量。

样例

样例输入 1

6
4 1 1 5 6 5

样例输出 1

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.