Language: C++

#include <algorithm>
#include <unordered_map>
using namespace std;

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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    REP(i, N) cin >> A[i];

    sort(A.begin(), A.end());

    vector<int> num(1e+6+1, 0);
    REP(i, N) ++num[A[i]];

    int ans = 0;
    vector<bool> divide(1e+6+1, false);
    REP(i, N){
        if(!divide[A[i]] and num[A[i]] == 1) ++ans;
        int tmp = A[i];
        for(int j = 1; tmp <= 1e+6; ++j){
            tmp = A[i]*j;
            if(divide[tmp]) break;
            divide[tmp] = true;
        }
    }
    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: 'cin' was not declared in this scope
   11 |     cin >> N;
      |     ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    2 | #include <unordered_map>
  +++ |+#include <iostream>
    3 | using namespace std;
a.cc:12:5: error: 'vector' was not declared in this scope
   12 |     vector<int> A(N);
      |     ^~~~~~
a.cc:3:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    2 | #include <unordered_map>
  +++ |+#include <vector>
    3 | using namespace std;
a.cc:12:12: error: expected primary-expression before 'int'
   12 |     vector<int> A(N);
      |            ^~~
a.cc:13:22: error: 'A' was not declared in this scope
   13 |     REP(i, N) cin >> A[i];
      |                      ^
a.cc:15:10: error: 'A' was not declared in this scope
   15 |     sort(A.begin(), A.end());
      |          ^
a.cc:17:12: error: expected primary-expression before 'int'
   17 |     vector<int> num(1e+6+1, 0);
      |            ^~~
a.cc:18:17: error: 'num' was not declared in this scope; did you mean 'enum'?
   18 |     REP(i, N) ++num[A[i]];
      |                 ^~~
      |                 enum
a.cc:21:12: error: expected primary-expression before 'bool'
   21 |     vector<bool> divide(1e+6+1, false);
      |            ^~~~
a.cc:23:13: error: 'divide' was not declared in this scope
   23 |         if(!divide[A[i]] and num[A[i]] == 1) ++ans;
      |             ^~~~~~
a.cc:23:30: error: 'num' was not declared in this scope; did you mean 'enum'?
   23 |         if(!divide[A[i]] and num[A[i]] == 1) ++ans;
      |                              ^~~
      |                              enum
a.cc:27:16: error: 'divide' was not declared in this scope
   27 |             if(divide[tmp]) break;
      |                ^~~~~~
a.cc:28:13: error: 'divide' was not declared in this scope
   28 |             divide[tmp] = true;
      |             ^~~~~~
a.cc:31:5: error: 'cout' was not declared in this scope
   31 |     cout << ans << endl;
      |     ^~~~
a.cc:31:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:31:20: error: 'endl' was not declared in this scope
   31 |     cout << ans << endl;
      |                    ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    2 | #include <unordered_map>
  +++ |+#include <ostream>
    3 | using namespace std;