#include #define rep(i, n) for(int i = 0; i < (int)n; i++) using namespace std; using ll = long long; using P = pair; constexpr ll mod = 1000000007; int main() { int n; cin >> n; vector a(n); rep(i, n) cin >> a[i]; set s; vector d; s.insert(1); rep(i, n) { for(int j = 1; j * j <= a[i]; j++) { if(a[i] % j == 0) { if(!s.count(j)) { s.insert(j); d.push_back(j); } if(!s.count(a[i] / j)) { s.insert(a[i] / j); d.push_back(a[i] / j); } } } } sort(d.begin(), d.end()); reverse(d.begin(), d.end()); int m = (int)d.size(); vector dp(m, 0); ll ans = (1LL << n) - 1; rep(i, m) { int c = 0; rep(j, n) if(a[j] % d[i] == 0) c++; dp[i] = (1LL << c) - 1; for(int j = 0; j < i; j++) { if(d[j] % d[i] == 0) { dp[i] -= dp[j]; } } ans -= dp[i]; } cout << ans << endl; return 0; }