Language: C++

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define fastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define pb push_back
#define ff first
#define ss second
#define all(v) (v).begin(), (v).end()
#define mod (int)(998244353)
#define PI 3.14159265358979323846264338327950L
#define debug(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << "[ " << *it << " = " << a << " ] ";
    err(++it, args...);
}

signed main(){

    fastIO

    int t = 1;
    // cin >> t;
    while (t--){
   		int n;
   		cin >> n;
   		vector<int> a(n);
   		set<int> s;
   		int mx = 0;
   		for (int i = 0; i < n; i++) {
   			cin >> a[i]; 
   			mx = max(a[i], mx);
   			s.insert(a[i]);
   			if (a[i] == 1) {
   				cout << 0 << endl;
   				exit(0);
   			}
   		}
   		int ans;
   		if (s.size() == n) ans = n;
   		else ans = s.size() - 1;
   		if (ans == 0) {
   			cout << 0 << endl;
   			exit(0);
   		}
   		set<int> in;
   		for (int val : s) {
   			for (int i = 2*val; i <= mx; i += val) {
   				if (in.find(i) == in.end()){
	   				if (s.find(i) != s.end()) {
	   					ans--;
	   					in.insert(i);
	   				}
	   			}
   			}
   		}
   		cout << max(ans, 0) << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:28: error: no matching function for call to 'max(long long int&, int)'
   60 |                 cout << max(ans, 0) << endl;
      |                         ~~~^~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:60:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   60 |                 cout << max(ans, 0) << endl;
      |                         ~~~^~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:60:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   60 |                 cout << max(ans, 0) << endl;
      |                         ~~~^~~~~~~~