#include using namespace std; typedef pair pii; typedef long long ll; const int N = 2000086, MOD = 1e9 + 7, INF = 0x3f3f3f3f; ll res; int n, m, cnt, w[N]; bool st[N], st1[N], st2[N]; int main() { cin >> n; for (int i = 1; i < n + 1; i++) scanf("%d", w + i), st[i] = 1; for (int i = 1; i < n + 1; i++) st[w[i]] = 0; for (int i = 1; i < n + 1; i++) if (st[i] && w[i]) st1[w[i]] = 1; for (int i = 1; i < n + 1; i++) if (st1[i] && w[i]) { res += !st2[w[i]]; st2[w[i]] = 1; } printf("%lld\n", res); return 0; }