Language: C++

#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	i_os;
	ll n;
	cin>>n;
	unordered_map<ll,ll> um;
	ll arr[n];
	REP(i,0,n){
		cin>>arr[i];
		um[arr[i]]++;
	}
	if(um.count(1) && um[1] > 1){
		cout<<0<<endl;
		return 0;
	}
	else if(um.count(1) && um[1] == 1){
		cout<<1<<endl;
		return 0;	
	}

	ll ct = n;
	REP(i,0,n){
		ll val = arr[i];
		REP(j,1,sqrt(arr[i]) + 1)
		{
			if(val % j == 0)
			{
				if(j == 1){
					if(um[val] > 1){
						ans[i] = 0;
						ct--;
						break;
					}
					else if(val != j && um.count(j)){
						ans[i] = 0;
						ct--;
						break;
					}
				}
				else {
					if(um.count(val/j)){
						ans[i] = 0;
						ct--;
						break;	
					}
					else if(j != val && val/j != j && um.count(j)){
						ans[i] = 0;
						ct--;
						break;
					}
				}
			}
		}
	}
	cout<<ct<<endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   58 |                                                 ans[i] = 0;
      |                                                 ^~~
      |                                                 abs
a.cc:63:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   63 |                                                 ans[i] = 0;
      |                                                 ^~~
      |                                                 abs
a.cc:70:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   70 |                                                 ans[i] = 0;
      |                                                 ^~~
      |                                                 abs
a.cc:75:49: error: 'ans' was not declared in this scope; did you mean 'abs'?
   75 |                                                 ans[i] = 0;
      |                                                 ^~~
      |                                                 abs