#include <bits/stdc++.h>
using namespace std;
const int N = 10001000, P = 1000000007;
int i, j, k, n, m, nm, pn, dn, x, num, ch, ans;
int f[N], mul[N], pr[N / 10];
int A[N], B[N], C[N], tm2[N];
int p[10], d[550];
void R(int &x) {
  x = 0;
  ch = getchar();
  while (ch < '0' || '9' < ch) ch = getchar();
  while ('0' <= ch && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
}
void pre(int n) {
  int i, j, k;
  tm2[0] = 1;
  for (i = 1; i <= n; i++) tm2[i] = tm2[i - 1] * 2 % P;
  mul[1] = 1;
  for (i = 2; i <= n; i++) {
    if (!f[i]) {
      mul[i] = -1;
      f[i] = i;
      pr[++nm] = i;
    }
    for (j = 1; j <= nm; j++) {
      if (i * pr[j] > n) break;
      f[i * pr[j]] = pr[j];
      if (pr[j] == f[i]) {
        mul[i * pr[j]] = 0;
        break;
      }
      mul[i * pr[j]] = -mul[i];
    }
  }
  for (i = 1; i <= n; i++)
    if (mul[i] < 0) mul[i] = P - 1;
}
int main() {
  R(n);
  for (i = 1; i <= n; i++) {
    R(x), C[x]++;
    if (x > m) m = x;
  }
  pre(m);
  for (i = 1; i <= m; i++)
    if (C[i]) {
      k = i;
      pn = dn = 0;
      while (k > 1) {
        p[++pn] = f[k];
        j = f[k];
        while (k % j == 0) k /= j;
      }
      d[++dn] = 1;
      for (j = 1; j <= pn; j++) {
        int t = dn;
        for (k = 1; k <= t; k++) d[t + k] = d[k] * p[j];
        dn += dn;
      }
      for (j = 1; j <= dn; j++) A[d[j]] += C[i];
    }
  for (i = 1; i <= m; i++) B[i] = A[i];
  for (i = 1; i <= m; i++) A[i] = (tm2[A[i]] + P - 1) % P;
  num = 0;
  for (i = 1; i <= m; i++) num = ((long long)mul[i] * A[i] + num) % P;
  ans = (P - (long long)n * num % P) % P;
  for (i = 1; i <= m; i++)
    ans = ((long long)mul[i] * A[i] % P * B[i] + ans) % P;
  printf("%d\n", ans);
}
