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?


-----Input-----

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.


-----Output-----

In the only line print a single integer — the minimum possible number of rooms in Paris catacombs.


-----Examples-----
Input
2
0 0

Output
2

Input
5
0 1 0 1 3

Output
3



-----Note-----

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

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

Difficulty: interview

Starter code:

Solutions:
n = int(input())

mas = list(map(int, input().split()))

dist = set([0])
res = 1
for i, e in enumerate(mas):
    time = i + 1
    if e in dist:
        dist.remove(e)
    else:
        res += 1
    dist.add(time)
print(res)

n = int(input())
a = list(map(int, input().split()))

now_time = 1
count_v = 1
last_time = [0 for i in range(2 * 10**5 + 10)]
last_time[0] = 1

for i in range(n):
    if last_time[a[i]] > 0:
        last_time[a[i]] -= 1
    else:
        count_v += 1

    last_time[now_time] += 1
    now_time += 1


print(count_v)

n = int(input())
l = list(map(int, input().split()))
a = [0 for i in range(200001)]
for x in l:
  a[x] = 1

for i in range(1, 200001):
  n -= a[i]
  
print(n)

n = int(input())
l = list(map(int, input().split()))
d = {}
s = set()
s.add(0)
d[0] = 1
ans = 1
for i in range(n):
    if l[i] in s:
        d[i + 1] = d[l[i]]
        s.remove(l[i])
        s.add(i + 1)
    else:
        s.add(i + 1)
        ans += 1
        d[i + 1] = ans
print(ans)


n = int(input())
minutesUsed = [0 for _ in range(n)]

count = 1
for v in [int(k) for k in input().split(' ') if k]:
    if minutesUsed[v]:
        count += 1
    else:
        minutesUsed[v] = 1
print(count)


n = int(input())
a = [int(i) for i in input().split()]
vis = [False] * n
ans = 0
for i in range(n):
    if a[i] == 0:
        ans += 1
        vis[0] = True
    elif vis[a[i]]:
        ans += 1
    else:
        vis[a[i]] = True
print(ans)

def main():
    n = int(input())
    times = list(map(int, input().split()))
    mntm = set()
    mntm.add(0)
    ans = 1
    for t in range(n):
        if times[t] in mntm:
            mntm.discard(times[t])
            mntm.add(t + 1)
        else:
            ans += 1
            mntm.add(t + 1)
    print(ans)


main()


import sys
input()
k=list(map(int,input().split()))
l=[]
s=[0 for i in range(200001)]
t=1
for i in k:
    if s[i]==1:
        s[i]=0
    s[t]=1
    t+=1
print(sum(s))
        


n, data = int(input()), list(map(int, input().split()))
time = [0] + [-100] * (3 * (10 ** 5))
rooms = [0]
for i in range(1, n + 1):
    if(time[data[i - 1]] != -100 and rooms[time[data[i - 1]]] == data[i - 1]):
        rooms[time[data[i - 1]]] = i
        time[i] = time[data[i - 1]]
    else:
        rooms.append(i)
        time[i] = len(rooms) - 1
print(len(rooms))

import sys;

#sys.stdin = open("input.txt", "r");
#sys.stdout = open("output.txt", "w");

def ria():
    return [int(x) for x in input().split()];


n = int(input());
a = ria();
a = [0] + a;
time = [-1] * (n+1);
time[0] = 0;
tf = 0;


for i in range(1,n+1,1):
    if time[a[i]] != -1:
        time[i] = time[a[i]];
        time[a[i]] = -1;
    else:
        tf += 1;
        time[i] = tf;

tf += 1;

print(tf);
    
    


#sys.stdout.close();


n = int(input())
a = list(map(int, input().split()))
time = [-1] * (n + 1)
time[0] = 1
count = 1
for i in range(n):
    cur_time = i + 1
    if time[a[i]] != -1:
        time[a[i]], time[cur_time] = -1, time[a[i]]
    else:
        count += 1
        time[cur_time] = count
print(count)

n = int(input())
a = list(map(int, input().split()))
di = {0 : 0}
k = 1
q = 1
for i in a:
    if i in di:
        del di[i]
    else:
        q += 1
    di[k] = i
    k += 1
print(q)

n = int(input())
list1 = list(map(int, input().split()))
time = [0] * (n + 1)
time[0] = 1
ans = 1
for i in range(n):
    if time[list1[i]] == 1:
        time[i + 1] = 1
        time[list1[i]] = 0
    else:
        ans += 1
        time[i + 1] = 1
print(ans)

n = int(input())
notes = [int(x) for x in input().split()]
greatest_cave = 1
visits = {0: 1}
for time, curr in enumerate(notes, start=1):
    if curr in visits and visits[curr] != -1:
        visits[time] = visits[curr]
        visits[curr] = -1
    else:
        greatest_cave += 1
        visits[time] = greatest_cave
print(greatest_cave)


N = int(input())
texts = [0] * N
texts = input().split()

ends=set()
#print(ends)

ends.add(0)
#print(ends)

for i in range(N):
    if int(texts[i]) in ends:
        ends.remove(int(texts[i]))
        #print('-'+texts[i],end=' ')
    ends.add(i+1)
    #print(ends)

print(len(ends))



def main():

    n = int(input())

    a = [0]
    a += list(map(int, input().split()))

    p = [0] * 200001
    p[1] = 0
    k = [-1] * 200001
    k[0] = 1

    ans = 1

    cnt = 1

    for i in range(1, n + 1):
        if (i == 1):
            if (a[i] == 1):
                cnt += 1
                k[i] = cnt
                p[cnt] = i
                ans += 1
            else:
                k[i] = k[a[a[i]]]
                p[k[i]] = i

        elif (p[k[a[i]]] != a[i]):
            cnt += 1
            k[i] = cnt
            p[cnt] = i
            ans += 1
        else:
            k[i] = k[a[i]]
            p[k[i]] = i

    print(ans)

main()
        


n = int(input())
data = list(map(int, input().split()))
d = [False] * (n + 4)
d[0] = True
res = 1
for i in range(n):
    #print(d)
    if d[data[i]]:
        d[data[i]] = False
        d[i + 1] = True
    else:
        d[i + 1] = True
        res += 1
#print(d)
print(res)

n = int(input())
t = list(map(int, input().split()))
tcopy = t[::-1]
tbool = [False] * len(t)
ans = 0
for i in range(len(t)):
    if not tbool[len(t) - i - 1]:
        
        ans += 1
        j = len(t) - i - 1
        while not tbool[j]:
            tbool[j] = True
            j = t[j] - 1
            if j < 0:
                break
            
        
        tbool[len(t) - i - 1] = True
print(ans)


n=int(input())
m=list(map(int,input().split(' ')))
s=set()
s.add(1)
for i in range(1,len(m)):
    try:
        s.remove(m[i])
        s.add(i+1)
    except:
        s.add(i+1)
print(len(s))


import fractions
import math
n=int(input())
#a,b=map(int,input().split(' ')) 
#n=list(map(int,input().split(' ')))
t=list(map(int,input().split(' ')))
a=set(t)
print(n+1-len(a))


i = int(input())
ctc = [0] + list(map(int, input().split()))
nm = 1
ptor = {0:1}
for i in range(1, len(ctc)):
    if  ctc[i] in list(ptor.keys()):
        ptor[i] = ptor[ctc[i]]
        del(ptor[ctc[i]])
    else:
        nm+=1
        ptor[i] = nm
print(nm)


n=int(input())
a=list(map(int,input().split()))
mn=set()
mn.add(0)
k=1
for i in range(n):
    if a[i] in mn:
        mn-={a[i]}
        mn.add(i+1)
    else:
        k+=1
        mn.add(i+1)
print(k)