#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10, M = 1e7 + 10, skc = 1e9 + 7;
int mu[M], c[M], ans, po[N], n, vi[M], pri[M], len;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int w = 0, x;
  po[0] = 1;
  for (register int i = (1); i <= (n); ++i)
    cin >> x, c[x]++, po[i] = 2ll * po[i - 1] % skc, w = max(w, x);
  for (register int i = (2); i <= (w); ++i) {
    if (!vi[i]) {
      vi[i] = i;
      pri[++len] = i;
      mu[i] = -1;
    }
    for (register int j = (1); j <= (len); ++j) {
      if (1ll * pri[j] * i > w || vi[i] < pri[j]) break;
      vi[i * pri[j]] = pri[j];
      mu[i * pri[j]] = (i % pri[j] ? -mu[i] : 0);
    }
  }
  for (register int i = (2); i <= (w); ++i) {
    if (mu[i] == 0) continue;
    int cnt = 0;
    for (int j = i; j <= w; j += i) cnt += c[j];
    ans = (ans + 1ll * (-mu[i]) * (n - cnt) * (po[cnt] - 1 + skc) % skc) % skc;
  }
  cout << (ans + skc) % skc << '\n';
  return 0;
}
