#include<iostream>
#include<map>
using namespace std;
int main(){
    int n;
    cin>>n;
    int temp;
    map<int,int>mp;
    int count=0;
    while(cin>>temp){
        if(temp>=1&&temp<=n&&mp[temp]<2)
        count++;
        mp[temp]++;
    }
    cout<<count<<endl;
    return 0;
}