#include <bits/stdc++.h>
using namespace std;
const int kMaxV = 2e5;
struct DisjointSets {
DisjointSets(int n=kMaxV+1)
: parent(n, -1),
weight(n, 0),
to(n, -1)
{ }
void MarkActive(const int id) {
if (parent[id] == -1) {
parent[id] = id;
weight[id] = 1;
to[id] = id;
}
}
int operator [](const int id) const {
return parent[id];
}
void Unite(int a, int b) {
a = (*this)[a]; b = (*this)[b];
if (a == b) {
return;
}
if (weight[a] < weight[b]) {
swap(a, b);
}
parent[b] = a;
weight[a] += weight[b];
int it = b;
do {
parent[it] = a;
it = to[it];
} while (it != b);
swap(to[b], to[a]);
}
int Weight(const int node) const {
return weight[(*this)[node]];
}
bool Singleton(const int node) const {
return Weight(node) == 1;
}
vector<int> parent, weight, to;
} dsu;
int divisor[kMaxV + 1];
int node_weight[kMaxV + 1];
vector<int> active;
int pos_in_active[kMaxV + 1], num_active[kMaxV + 1];
bool erased[kMaxV + 1];
vector<int> values[kMaxV + 1];
vector<int> primes;
void Init() {
for (int i = 2; i <= kMaxV; ++i) {
if (divisor[i]) {
continue;
}
divisor[i] = i;
primes.push_back(i);
for (int j = 2 * i; j <= kMaxV; j += i) {
divisor[j] = i;
}
}
}
void Backtrack(int num, int pos) {
if (pos == (int)primes.size() or num > kMaxV / primes[pos]) {
return;
}
Backtrack(num, pos + 1);
// erase primes[pos]
vector<int> changes;
for (auto it : values[primes[pos]]) {
if (not erased[it]) {
erased[it] = true;
--num_active[dsu[it]];
if (num_active[dsu[it]] == 0) {
pos_in_active[active.back()] = pos_in_active[dsu[it]];
swap(active[pos_in_active[active.back()]], active.back());
pos_in_active[dsu[it]] = -1;
active.pop_back();
}
changes.push_back(it);
}
}
num *= primes[pos];
if (node_weight[num] > 0 and not active.empty()) {
if (num_active[dsu[num]] == 0) {
active.push_back(num);
}
int new_num_active = num_active[dsu[active[0]]];
for (int i = 1; i < (int)active.size(); ++i) {
new_num_active += num_active[dsu[active[i]]];
dsu.Unite(active[i - 1], active[i]);
}
int comp = dsu[active[0]];
active.clear();
active.push_back(comp);
pos_in_active[comp] = 0;
num_active[comp] = new_num_active;
}
Backtrack(num, pos + 1);
// undo erase
for (auto it : changes) {
erased[it] = false;
++num_active[dsu[it]];
if (pos_in_active[dsu[it]] == -1) {
pos_in_active[dsu[it]] = (int)active.size();
active.push_back(dsu[it]);
}
}
changes.clear();
}
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
Init();
int n; cin >> n;
for (int i = 0; i < n; ++i) {
int x; cin >> x;
if (x == 1) {
cout << 1 << endl;
return 0;
}
int last = -1, square_free_form = 1;
vector<int> prime_divisors;
while (x > 1) {
if (divisor[x] != last) {
square_free_form *= divisor[x];
last = divisor[x];
prime_divisors.push_back(divisor[x]);
}
x /= divisor[x];
}
for (auto it : prime_divisors) {
values[it].push_back(square_free_form);
}
++node_weight[square_free_form];
}
for (int i = 2; i <= kMaxV; ++i) {
if (node_weight[i] == 0) {
continue;
}
sort(values[i].begin(), values[i].end());
values[i].erase(
unique(values[i].begin(), values[i].end()), values[i].end());
dsu.MarkActive(i);
num_active[i] = 1;
pos_in_active[i] = (int)active.size();
active.push_back(i);
}
Backtrack(1, 0);
int num_components = 0;
for (int i = 2; i <= kMaxV; ++i) {
if (node_weight[i] == 0 or dsu[i] != i) {
continue;
}
if (dsu.Singleton(i)) {
num_components += node_weight[i];
} else {
++num_components;
}
}
cout << num_components << endl;
}