#include <bits/stdc++.h>
using namespace std;
int a1234;
inline void xxx() {
  for (;;)
    ;
}
inline int rd(int l, int r) { return rand() % (r - l + 1) + l; }
const int mxn = 5e5 + 3, mxm = 1e7 + 3, mod = 1e9 + 7;
int n, a[mxn], m;
int t1[mxm], t2[mxm];
int pr[mxm], pt, v[mxm], mu[mxm];
int bin[mxn];
int main() {
  a1234 = scanf("%d", &n);
  for (int i = 1; i <= n; ++i) a1234 = scanf("%d", a + i), m = max(m, a[i]);
  mu[1] = 1;
  for (register int i = 2; i < mxm; ++i) {
    if (!v[i]) pr[++pt] = i, v[i] = i, mu[i] = -1;
    for (register int j = 1; j <= pt && pr[j] * i < mxm && pr[j] <= v[i]; ++j) {
      v[i * pr[j]] = pr[j];
      if (pr[j] != v[i]) mu[i * pr[j]] = -mu[i];
    }
  }
  for (int i = 1; i <= n; ++i) ++t2[a[i]];
  for (register int i = 1; i <= pt; ++i) {
    for (register int j = m / pr[i]; j; --j)
      t2[j] = (t2[j] + t2[j * pr[i]]) % mod;
  }
  bin[0] = 1;
  for (int i = 1; i <= n; ++i) bin[i] = bin[i - 1] * 2 % mod;
  for (int i = 1; i <= m; ++i) t1[i] = bin[t2[i]] - 1;
  long long tmp = 0;
  for (int i = 1; i <= m; ++i) tmp += mu[i] * t1[i];
  tmp %= mod;
  t1[1] -= tmp;
  long long ans = 0;
  for (register int i = 1; i <= m; ++i)
    ans += 1ll * mu[i] * t1[i] * t2[i] % mod;
  ans %= mod;
  if (ans < 0) ans += mod;
  printf("%lld\n", ans);
  return 0;
}
