#include <bits/stdc++.h>
constexpr int mod = 1000000007, maxn = 10000010, N = 10000000;
inline void up(int& x) { x += x >> 31 & mod; }
int mnp[maxn], p[maxn], mu[maxn], cnt;
void sieve(int n) {
  mu[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!mnp[i]) mnp[i] = i, p[cnt++] = i, mu[i] = mod - 1;
    for (int j = 0; j < cnt && p[j] * i <= n; ++j) {
      mnp[p[j] * i] = p[j];
      if (!(i % p[j])) {
        mu[p[j] * i] = 0;
        break;
      }
      up(mu[p[j] * i] = -mu[i]);
    }
  }
}
int c[maxn], _pow[maxn];
int main() {
  std::ios_base::sync_with_stdio(0), std::cin.tie(0);
  int n;
  std::cin >> n;
  sieve(N);
  for (int i = 1; i <= n; ++i)
    up(_pow[i] = _pow[i - 1] + _pow[i - 1] + 1 - mod);
  for (int i = 0, x; i < n; ++i) std::cin >> x, ++c[x];
  for (int i = 0; i < cnt; ++i)
    for (int t = N / p[i], j = t * p[i]; t; --t, j -= p[i]) c[t] += c[j];
  int ans = 0;
  for (int d = 1, t; d <= N; ++d)
    up(t = c[d] - n), ans = (ans + 1ll * t * _pow[c[d]] % mod * mu[d]) % mod;
  std::cout << ans << std::endl;
}
