/*Points to be noted :
1)Don't be afraid to fail.
2)Never give up easily,keep trying.
3)Don't care about other ppl's progress.
4)Spend much time on each problem & keep trying. I WILL DO IT!💯*/

// Mere bas ka nahi hai
// still i'm trying
// apna time aayega
//
//        .--------------.  
//        | Try First One|
//        '--------------'
//                |     .--------------.
//                |     |              |
//                V     V              |
//              .--------------.       |
//              |      AC.     |<---.  |  
//              '--------------'    |  |
//              (True)|  |(False)   |  |
//           .--------'  |          |  |
//           |           V          |  |
//           |  .--------------.    |  |
//           |  |   Try Again  |----'  |
//           |  '--------------'       |
//           |                         |
//           |  .--------------.       |
//           '->| Try Next One |-------'
//              '--------------'                          		  
//


#include<bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
#define int long long int
#define ld long double
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define r0 return 0;
#define tc int t;cin>>t;while(t--)
#define for0(i, n) for (int i = 0; i < n; i++)
#define for1(i, n) for (int i = 1; i <= n; i++)
#define loop(i,a,b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vii vector<long long int>
#define SORT(v) sort(v.begin(),v.end());
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define md 998244353
#define inf 1000000000000000 //1e15
#define gcd __gcd
#define lcm(a,b) ((a)*(b))/gcd(a,b)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define crap ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"
int min(int a,int b){
    return (a<b)?a:b;
}
int max(int a,int b){
    return (a>b)?a:b;
}
int fp(int a,int b){
    if(b==0) return 1;
    int x=fp(a,b/2);
    x=(x*x)%mod;
    if(b&1) x=(x*a)%mod;
    return x;
}
int factorial(int n)
{
    int fact=1;
    for(int i=2;i<=n;i++)
    fact=fact*i;
    
    return fact;
}
int ncr(int n,int r)
{
    return factorial(n)/(factorial(r)*factorial(n-r));
}
void c_p_c()
{
    crap;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
void divisibilityCheck(int arr[], int n) 
{ 
  
    // Storing all array elements in a hash 
    // and finding maximum element in the array 
    unordered_set<int> s; 
    int max_ele = INT_MIN; 
    for (int i = 0; i < n; i++) { 
        s.insert(arr[i]); 
  
        // Update the maximum element of the array 
        max_ele = max(max_ele, arr[i]); 
    } 
  
    // Traversing the array elements and storing the array 
    // multiples that are present in s in res 
    unordered_set<int> res; 
    for (int i = 0; i < n; i++) { 
  
        // Check for non-zero values only 
        if (arr[i] != 0) { 
  
            // Checking the factors of current element 
            for (int j = arr[i] * 2; j <= max_ele; j += arr[i]) { 
  
                // If current factor is already part 
                // of the array then store it 
                if (s.find(j) != s.end()) 
                    res.insert(j); 
            } 
        } 
    } 
  
    // For non-distinct elmments 
    // To store the frequency of elements 
    unordered_map<int, int> mp; 
    for (int i = 0; i < n; i++) 
        mp[arr[i]]++; 
  
    unordered_map<int, int>::iterator it; 
    vector<int> ans; 
    for (it = mp.begin(); it != mp.end(); it++) { 
  
        // If frequency is at least 2 
        if (it->second >= 2) { 
            if (res.find(it->first) == res.end()) { 
  
                // If frequency is greater than 1 and 
                // the number is not divisible by 
                // any other number 
                int val = it->second; 
  
                // Then we push the element number of 
                // times it is present in the vector 
                while (val--) 
                    ans.push_back(it->first); 
            } 
        } 
  
        // If frequency is greater than 1 and the number 
        // is divisible by any other number 
        if (res.find(it->first) != res.end()) { 
            int val = it->second; 
  
            // Then we push the element number of 
            // times it is present in the vector 
            while (val--) 
                ans.push_back(it->first); 
        } 
    } 
  
    // Print the elements that are divisible by 
    // at least one other element from the array 
    cout<<n-ans.size()<<endl;
} 
  
signed main()
{
    c_p_c();
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    divisibilityCheck(a,n);
}

Measured memory_bytes: 32364