// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

 

using ll = long long;

using ld = long double;

using vi = vector<int>;

using vvi = vector<vector<int>>;

using vvvi = vector<vector<vector<int>>>;

using vl = vector<ll>;

using vvl = vector<vector<ll>>;

using vvvl = vector<vector<vector<ll>>>;

#define FOR(i, m, n) for (int i = (m); i < (n); i++)

#define FORR(i, m, n) for (int i = (m); i >= (n); i--)

#define REP(i, n) FOR(i, 0, (n))

#define REPR(i, n) FORR(i, (n) - 1, 0)

#define REP1(i, n) FOR(i, 1, (n) + 1)

#define REPS(c, s) for (char c : s)

#define ALL(c) (c).begin(), (c).end()

#define SORT(c) sort(ALL(c))

#define REV(c) reverse(ALL(c))

#define sz(v) (int)v.size()

#define endl '\n'

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}

template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}

template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}

template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}

template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}

template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}

const int MOD = 1000000007;

const int INF = 1000000001;

const ll LINF = 1000000001000000001LL;

 

void solve();

 

int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout << fixed << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;

}



vector<ll> divisors(ll n) {

    vector<ll> v;

    for (ll i = 1; i * i <= n; i++) {

        if (n % i == 0) {

            v.push_back(i);

            if (i * i != n) {

                v.push_back(n / i);

            }

        }

    }

    return v;

}



void solve() {

    int n;

    cin >> n;

    vi a(n);

    vvl d(n, vl());

    vi s(1001001);

    REP(i, n) {

        cin >> a[i];

        s[a[i]]++;

        d[i] = divisors(a[i]);

    }

    int ans = 0;

    REP(i, n) {

        bool ok = true;

        for (auto e : d[i]) {

            if (s[e] > 1 or (s[e] == 1 and e != a[i])) {

                ok = false;

                break;

            }

        }

        if (ok) ans++;

        // cout << i << ": " << ans << endl;

    }

    cout << ans << endl;

}


// Faster C++ solution for the same problem (measured speedup: 2.462261376839448x):
#include <bits/stdc++.h>

using namespace std;



using ll = long long;

using ld = long double;

using vi = vector<int>;

using vvi = vector<vector<int>>;

using vvvi = vector<vector<vector<int>>>;

using vl = vector<ll>;

using vvl = vector<vector<ll>>;

using vvvl = vector<vector<vector<ll>>>;

using vs = vector<string>;

using vb = vector<bool>;

#define FOR(i, m, n) for (int i = (m); i < (n); i++)

#define FORR(i, m, n) for (int i = (m); i >= (n); i--)

#define REP(i, n) FOR(i, 0, (n))

#define REPR(i, n) FORR(i, (n) - 1, 0)

#define REP1(i, n) FOR(i, 1, (n) + 1)

#define REPS(c, s) for (char c : s)

#define ALL(c) (c).begin(), (c).end()

#define SORT(c) sort(ALL(c))

#define REV(c) reverse(ALL(c))

#define sz(v) (int)v.size()

#define endl '\n'

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}

template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}

template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}

template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}

template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}

template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}

const int MOD = 1000000007;

const int INF = 1000000001;

const ll LINF = 1000000001000000001LL;



void solve();

 

int main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout << fixed << setprecision(numeric_limits<double>::max_digits10);

    solve();

    return 0;

}



void solve() {

    int n;

    cin >> n;

    vi a(n);

    map<int, int> m;

    REP(i, n) {

        cin >> a[i];

        m[a[i]]++;

    }



    vb b(1000001, true);

    int ans = 0;

    for (auto e : m) {

        if (e.second == 1 and b[e.first]) ans++;

        if (b[e.first]) {

            for (int i = e.first; i <= 1000000; i += e.first) b[i] = false;

        }

    }

    cout << ans << endl;

}