#include <bits/stdc++.h>
using namespace std;
vector<int> prime, factor[500005];
int mv[10000000 + 2];
int cnt[10000000 + 7], add[10000000 + 2];
bool flag[10000000 + 2];
void sieve() {
  for (int i = 2; i <= 10000000; i++) mv[i] = 1;
  for (int i = 4; i <= 10000000; i += 2) {
    mv[i] *= -1;
    if ((i / 2) % 2 == 0) mv[i] = 0;
    flag[i] = true;
  }
  int sq = sqrt(10000000);
  mv[2] = -1;
  prime.push_back(2);
  for (int i = 3; i <= 10000000; i += 2) {
    if (!flag[i]) {
      prime.push_back(i);
      mv[i] = -1;
      for (int j = i + i; j <= 10000000; j += i) {
        mv[j] *= -1;
        if (mv[j] && ((j / i) % i == 0)) mv[j] = 0;
        flag[j] = true;
      }
    }
  }
}
void factorize(int x, int id) {
  for (int i = 0; prime[i] * prime[i] <= x; i++) {
    if (x % prime[i] == 0) {
      factor[id].push_back(prime[i]);
      while (x % prime[i] == 0) x /= prime[i];
    }
  }
  if (x > 1) factor[id].push_back(x);
}
long long bigmod(long long b, long long p) {
  if (p < 0) return 0;
  long long ret = 1ll;
  while (p) {
    if (p & 1ll) ret = (ret * b) % 1000000007;
    b = (b * b) % 1000000007;
    p >>= 1ll;
  }
  return ret;
}
int ar[500005];
long long pw[500008];
int main() {
  sieve();
  pw[0] = 1ll;
  for (int i = 1; i <= 500005; i++) pw[i] = (pw[i - 1] * 2ll) % 1000000007;
  int n;
  cin >> n;
  int mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    cnt[ar[i]]++;
    mx = max(mx, ar[i]);
  }
  int rr = 0;
  for (int k = 0; k < n; k++) {
    factorize(ar[k], k);
  }
  long long all = bigmod(2ll, n);
  all = (all + 1000000007) % 1000000007;
  for (int i = 2; i <= mx; i++) {
    if (mv[i] == 0) continue;
    int ct = 0;
    for (int j = i; j <= mx; j += i) ct += cnt[j];
    long long B = pw[ct] - 1ll;
    all = ((all + B * mv[i]) % 1000000007 + 1000000007) % 1000000007;
    add[i] = ct;
  }
  all = (pw[n] - all) % 1000000007;
  if (all < 0) all += 1000000007;
  long long res = 0ll;
  for (int i = 0; i < n; i++) {
    int sz = factor[i].size();
    long long tmp = 0ll;
    long long num;
    int lm = (1 << sz) - 1, a;
    for (int j = 1; j <= lm; j++) {
      a = -1;
      num = 1;
      for (int k = 0; k < sz; k++) {
        if (j & (1 << k)) {
          a *= -1;
          num *= (long long)factor[i][k];
        }
      }
      tmp += (pw[add[num]] - 1ll) * (long long)a;
      tmp %= 1000000007;
      if (tmp < 0) tmp += 1000000007;
    }
    res += (all - tmp);
    res %= 1000000007;
    res += 1000000007;
    res %= 1000000007;
  }
  res %= 1000000007;
  if (res < 0ll) res += 1000000007;
  cout << res << endl;
  return 0;
}
