#include <bits/stdc++.h>
const int MAXW = 1E7 + 5;
const int W = 1E7, P = 1E9 + 7;
bool mark[MAXW];
int pri[MAXW], mu[MAXW];
int f[MAXW], g[MAXW];
int main() {
  int n, m = 0;
  scanf("%d", &n);
  mu[1] = 1;
  for (int i = 2; i <= W; i++) {
    if (!mark[i]) pri[++m] = i, mu[i] = -1;
    for (int j = 1; i * pri[j] <= W; j++) {
      mark[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 <= W; i++) g[i] = 1;
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    for (int d = 1; d * d <= x; d++)
      if (x % d == 0) {
        f[d]++, g[d] = ((g[d]) + (g[d]) < P ? (g[d]) + (g[d])
                                            : (g[d]) + (g[d]) - P);
        if (d * d != x) {
          int t = x / d;
          f[t]++, g[t] = ((g[t]) + (g[t]) < P ? (g[t]) + (g[t])
                                              : (g[t]) + (g[t]) - P);
        }
      }
  }
  for (int i = 1; i <= W; i++)
    f[i] = ((f[i] * mu[i]) + (P) < P ? (f[i] * mu[i]) + (P)
                                     : (f[i] * mu[i]) + (P)-P),
    g[i]--;
  for (int i = 1; i <= m; i++) {
    for (int j = 1; pri[i] * j <= W; j++)
      f[pri[i] * j] =
          ((f[pri[i] * j]) + (f[j]) < P ? (f[pri[i] * j]) + (f[j])
                                        : (f[pri[i] * j]) + (f[j]) - P);
    for (int j = 1; pri[i] * j <= W; j++)
      g[j] = ((g[j]) - (g[pri[i] * j]) < 0 ? (g[j]) - (g[pri[i] * j]) + P
                                           : (g[j]) - (g[pri[i] * j]));
  }
  int ans = 0;
  for (int i = 2; i <= W; i++) ans = (ans + 1ll * f[i] * g[i]) % P;
  printf("%d\n", ans);
  return 0;
}
