#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 5;
const int mod = 1e9 + 7;
bool isprime[N];
int prime[N];
int a[N], mu[N], pw2[N];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(2);
  int n, v, maxn, cnt, ans;
  cin >> n;
  memset(isprime, 1, sizeof(isprime));
  memset(a, 0, sizeof(a));
  memset(mu, 0, sizeof(mu));
  maxn = -1;
  for (int i = 0; i < n; i++) {
    cin >> v;
    a[v]++;
    maxn = max(maxn, v);
  }
  ans = cnt = 0;
  isprime[1] = 0;
  pw2[0] = 1;
  pw2[1] = 2;
  for (int i = 2; i <= maxn; i++) {
    pw2[i] = (pw2[i - 1] << 1) % mod;
    if (isprime[i]) {
      prime[cnt++] = i;
      mu[i] = -1;
    }
    for (int j = 0; j < cnt; j++) {
      long long v = 1ll * i * prime[j];
      if (v > maxn) break;
      isprime[v] = 0;
      if (i % prime[j] == 0) break;
      mu[v] = -mu[i];
    }
  }
  for (int i = 2; i <= maxn; i++) {
    if (mu[i] == 0) continue;
    int sum = a[i];
    for (int j = i + i; j <= maxn; j += i) {
      sum += a[j];
    }
    ans = (ans - 1ll * mu[i] * (pw2[sum] - 1) * (n - sum)) % mod;
  }
  cout << (ans + mod) % mod << '\n';
  return 0;
}
