#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10;
const int N = 1e7 + 10;
const int mod = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + c - '0';
    c = getchar();
  }
  return x * f;
}
int pri[N / 10], tot, mu[N];
bool flag[N];
int n, lim, c[N], g[N], s[N], p[maxn], ans;
int main() {
  n = read();
  for (int i = 1, x; i <= n; i++) x = read(), lim = max(lim, x), c[x]++;
  mu[1] = p[0] = 1;
  for (int i = 2; i <= lim; i++) {
    if (!flag[i]) pri[++tot] = i, mu[i] = -1;
    for (int j = 1; j <= tot && i * pri[j] <= lim; j++) {
      flag[i * pri[j]] = 1;
      if (i % pri[j] == 0) {
        mu[i * pri[j]] = 0;
        break;
      }
      mu[i * pri[j]] = -mu[i];
    }
  }
  for (int i = 1; i <= tot; i++)
    for (int j = lim / pri[i]; j; j--) c[j] += c[j * pri[i]];
  for (int i = 1; i <= lim; i++) g[i] = c[i] * mu[i];
  for (int i = 1; i <= tot; i++)
    for (int j = 1; j * pri[i] <= lim; j++) g[j * pri[i]] += g[j];
  for (int i = 1; i <= n; i++) p[i] = 2ll * p[i - 1] % mod;
  for (int i = 1; i <= lim; i++) s[i] = p[c[i]] - 1;
  for (int i = tot; i; i--)
    for (int j = 1; j * pri[i] <= lim; j++)
      s[j] = (s[j] - s[j * pri[i]] + mod) % mod;
  for (int i = 2; i <= lim; i++) ans = (ans + 1ll * g[i] * s[i] % mod) % mod;
  printf("%d\n", ans);
  return 0;
}
