#include "bits/stdc++.h" using namespace std; using ll = long long; using pii = pair; using pll = pair; using vi = vector; using vl = vector; using vvi = vector; using vvl = vector; const ll INF = 1LL << 60; const ll MOD = 1000000007; template bool chmax(T &a, const T &b) { return (a < b) ? (a = b, 1) : 0; } template bool chmin(T &a, const T &b) { return (b < a) ? (a = b, 1) : 0; } template void print(const C &c, std::ostream &os = std::cout) { std::copy(std::begin(c), std::end(c), std::ostream_iterator(os, " ")); os << std::endl; } // list up all factors template void factors(T a, set& facs) { for (T i = 1; i * i <= a; ++i) { if (a % i == 0) { facs.insert(i); facs.insert(a / i); } } } int main() { int n; cin >> n; vl a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } vector> facs(n); vl f; for (int i = 0; i < n; ++i) { factors(a[i], facs[i]); for (auto &fa : facs[i]) { f.push_back(fa); } } sort(f.begin(), f.end()); f.erase(unique(f.begin(), f.end()), f.end()); vl cnt(f.size()); for (int i = f.size()-1; i >= 0; --i) { int c = 0; for (int j = 0; j < n; ++j) { if (a[j] % f[i] == 0) c++; } cnt[i] = (1LL << c) - 1; for (int j = i + 1; j < f.size(); ++j) { if (f[j] % f[i] == 0) cnt[i] -= cnt[j]; } } cout << cnt[0] << "\n"; return 0; }