#include <bits/stdc++.h>
using namespace std;
bool IsPrime(int a) {
    if (a==2) {
        return true;
    } else if (a%2==0) {
        return false;
    } else {
        double SqrtNum=sqrt(a);
        for (int i=3;i<=SqrtNum;i+=2) {
            if (a%1==0) {
                return false;
            }
        }
        return true;
    }
}
int main(void){
    int n,a;
    cin>>n;
    int flag=0,count=0;
    std::deque<int> deq;
    for (int i=0;i<n;i++) {
        cin>>a;
        deq.emplace_back(a);
        if (a==1&&flag==0) {
            flag=1;
        } else if (a==1&&flag==1) {
            cout<<0<<endl;
            return 0;
        }
    }
    if (flag==1) {
        cout<<1<<endl;
        return 0;
    }
    sort(deq.begin(),deq.end());
    std::map<int, int> map;
    for (int i=0;i<n;i++) {
        if (i==0) {
            if (deq[i]!=deq[i+1]) {
                if (IsPrime(deq[i])==true) {
                    count++;
                    //cout<<deq[i]<<endl;
                    map[deq[i]]++;
                } else {
                    double tmp=sqrt(deq[i]);
                    int tmp_flag=0;
                    for (int j=1;j<=tmp;j++) {
                        if (deq[i]%j==0) {
                            if (map[j]!=0||map[deq[i]/j]!=0) {
                                tmp_flag=1;
                                break;
                            }
                        }
                    }
                    if (tmp_flag==0) {
                        count++;
                        //cout<<deq[i]<<endl;
                    }
                    map[deq[i]]++;
                }
            } else {
                map[deq[i]]++;
            }
        } else if (i==n-1) {
            if (deq[i]!=deq[i-1]) {
                if (IsPrime(deq[i])==true) {
                    count++;
                    //cout<<deq[i]<<endl;
                } else {
                    double tmp=sqrt(deq[i]);
                    int tmp_flag=0;
                    for (int j=1;j<=tmp;j++) {
                        if (deq[i]%j==0) {
                            if (map[j]!=0||map[deq[i]/j]!=0) {
                                tmp_flag=1;
                                break;
                            }
                        }
                    }
                    if (tmp_flag==0) {
                        count++;
                        //cout<<deq[i]<<endl;
                    }
                    map[deq[i]]++;
                }
            } else {
                map[deq[i]]++;
            }
        } else {
            if (deq[i]!=deq[i-1]&&deq[i]!=deq[i+1]) {
                if (IsPrime(deq[i]==true)) {
                    count++;
                    //cout<<deq[i]<<endl;
                } else {
                    double tmp=sqrt(deq[i]);
                    int tmp_flag=0;
                    for (int j=1;j<=tmp;j++) {
                        if (deq[i]%j==0) {
                            if (map[j]!=0||map[deq[i]/j]!=0) {
                                tmp_flag=1;
                                break;
                            }
                        }
                    }
                    if (tmp_flag==0) {
                        count++;
                        //cout<<deq[i]<<endl;
                    }
                    map[deq[i]]++;
                }
            } else {
                map[deq[i]]++;
            }
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 33344