CF886C.Petya and Catacombs

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 ii , he makes a note in his logbook with number tit_{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 ii .

Initially, Petya was in one of the rooms at minute 00 , he didn't write down number t0t_{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 nn ( 1<=n<=21051<=n<=2·10^{5} ) — then number of notes in Petya's logbook.

The second line contains nn non-negative integers t1,t2,...,tnt_{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
    

说明/提示

In the first sample, sequence of rooms Petya visited could be, for example 1121→1→2 , 1211→2→1 or 1231→2→3 . The minimum possible number of rooms is 22 .

In the second sample, the sequence could be 1231211→2→3→1→2→1 .

首页