#include <stdio.h>

int main(void){
  long int n,a[1000005],count[1000005]={0};
  scanf("%ld",&n);
  for(int i=1;i<=n;i++){
    scanf("%ld",&a[i]);
    count[a[i]]++;
    if(count[a[i]]!=0){
      count[a[i]]=2;
      continue;
    }
    for(int i=a[i];i<1000005;i+=a[i]) count[i]++;
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    if(count[i]==1) ans++;
  }

  printf("%d",ans);
  return 0;
}