304642: CF886C. Petya and Catacombs
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Petya and Catacombs
题意翻译
神鱼 NaCly_Fish 在图上游走。每一分钟她会随机选一条边,走到与其相邻的一个点(可以不动)。 第 $i$ 分钟神鱼会写下一个数字 $t_i$,规则如下: - 如果走到的是一个新点,随机写一个数字。 - 如果以前来过,写最近一次到这里的时间。 蒟蒻 regit2013 通过不明手段知道了 $t_1,\ldots,t_n$,他想知道这张图最少有几个点。 神鱼第 $0$ 分钟不会写下数字 $t_0$。题目描述
A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs. Catacombs consist of several rooms and bidirectional passages between some pairs of them. Some passages can connect a room to itself and since the passages are built on different depths they do not intersect each other. Every minute Petya arbitrary chooses a passage from the room he is currently in and then reaches the room on the other end of the passage in exactly one minute. When he enters a room at minute $ i $ , he makes a note in his logbook with number $ t_{i} $ : - If Petya has visited this room before, he writes down the minute he was in this room last time; - Otherwise, Petya writes down an arbitrary non-negative integer strictly less than current minute $ i $ . Initially, Petya was in one of the rooms at minute $ 0 $ , he didn't write down number $ t_{0} $ . At some point during his wandering Petya got tired, threw out his logbook and went home. Vasya found his logbook and now he is curious: what is the minimum possible number of rooms in Paris catacombs according to Petya's logbook?输入输出格式
输入格式
The first line contains a single integer $ n $ ( $ 1<=n<=2·10^{5} $ ) — then number of notes in Petya's logbook. The second line contains $ n $ non-negative integers $ t_{1},t_{2},...,t_{n} $ ( $ 0<=t_{i}<i $ ) — notes in the logbook.
输出格式
In the only line print a single integer — the minimum possible number of rooms in Paris catacombs.
输入输出样例
输入样例 #1
2
0 0
输出样例 #1
2
输入样例 #2
5
0 1 0 1 3
输出样例 #2
3