#include <bits/stdc++.h>
using std::cerr;
using std::endl;
const int N = 1e7 + 233, P = 1e9 + 7;
int prime[N], tot, mu[N];
bool vis[N];
inline void init(int n) {
  mu[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!vis[i]) prime[++tot] = i, mu[i] = -1;
    for (int j = 1; j <= tot && i * prime[j] <= n; ++j) {
      vis[i * prime[j]] = 1;
      if (!(i % prime[j])) {
        mu[i * prime[j]] = 0;
        break;
      }
      mu[i * prime[j]] = -mu[i];
    }
  }
}
const int M = 5e5 + 233;
int n, cnt[N], sum[N], f[N], max, pow2[M];
int main() {
  init(1e7);
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    ++cnt[x];
    max = std::max(max, x);
  }
  pow2[0] = 1;
  for (int i = 1; i <= n; ++i) pow2[i] = pow2[i - 1] * 2 % P;
  for (int i = 1; i <= max; ++i) {
    for (int j = i; j <= max; j += i) sum[i] += cnt[j];
    f[i] = pow2[sum[i]] - 1;
  }
  for (int i = 1; i <= max; ++i)
    for (int j = i + i; j <= max; j += i) f[i] = (f[i] + mu[j / i] * f[j]) % P;
  int ans = 0;
  for (int d = 1; d <= max; ++d) {
    if (!mu[d]) continue;
    long long tmp1 = 0, tmp2 = sum[d];
    for (int i = d; i <= max; i += d) {
      tmp1 = (tmp1 + f[i]) % P;
    }
    tmp1 = 1ll * tmp1 * tmp2 % P;
    if (mu[d] == -1) tmp1 = P - tmp1;
    ans = (ans + tmp1) % P;
  }
  ans = (ans - 1ll * sum[1] * f[1]) % P;
  ans = (ans % P + P) % P;
  std::cout << ans << std::endl;
  return 0;
}
