#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  register long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return (f == 1) ? x : -x;
}
int cnt[10101010], X[10101010];
bool vis[10101010];
long long F[10101010], pw2[1101010];
int tot, p[1010101], a[1010101], lim, mu[10101010];
inline void seive(int n) {
  for (int i = 2; i <= n; i++) {
    if (!vis[i]) p[++tot] = i, X[i] = i, mu[i] = -1;
    for (int j = 1; j <= tot; j++) {
      if (1ll * p[j] * i > n) break;
      vis[p[j] * i] = 1, mu[p[j] * i] = -mu[i];
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        X[i * p[j]] = X[i];
        break;
      } else
        X[i * p[j]] = X[i] * p[j];
    }
  }
}
inline void FMTand(long long *F, int lim) {
  for (int i = 1; i <= tot; i++) {
    for (int j = lim / p[i]; j; j--) {
      F[j] = (F[j] + F[j * p[i]]) % 1000000007;
    }
  }
}
inline void FMTor(long long *F, int lim) {
  for (int i = 1; i <= tot; i++) {
    for (int j = 1; j * p[i] <= lim; j++) {
      F[j * p[i]] = (F[j * p[i]] + F[j]) % 1000000007;
    }
  }
}
signed main() {
  long long n = read();
  pw2[0] = 1;
  for (int i = 1; i <= n; i++) pw2[i] = 1ll * pw2[i - 1] * 2 % 1000000007;
  for (int i = 1; i <= n; i++) {
    a[i] = read();
    cnt[a[i]]++;
    lim = max(lim, a[i]);
    F[a[i]] = cnt[a[i]];
  }
  seive(lim);
  FMTand(F, lim);
  long long ONE = pw2[F[1]] - 1, _ = 0;
  for (int i = 2; i <= lim; i++) {
    ONE =
        (1000000007 + ONE + mu[i] * (pw2[F[i]] - 1) % 1000000007) % 1000000007;
  }
  for (int i = 1; i <= lim; i++) {
    F[i] = (1000000007 + (pw2[F[i]] - 1) * (1000000007 - mu[i]) % 1000000007) %
           1000000007;
  }
  FMTor(F, lim);
  for (int i = 1; i <= lim; i++) {
    _ = (_ + 1ll * cnt[i] * (pw2[n] - 1 - ONE - F[X[i]]) % 1000000007) %
        1000000007;
  }
  cout << (_ % 1000000007 + 1000000007) % 1000000007;
  return 0;
}
