#include <bits/stdc++.h>
using namespace std;
int read() {
  char ch = getchar();
  int x = 0, fl = 1;
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') fl = -1;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch - '0');
  return x * fl;
}
const int NN = 500000 + 17;
const int MM = 10000000 + 17;
void open() {
  freopen("a.in", "r", stdin);
  freopen("a.out", "w", stdout);
}
int n, maxx;
int pw[NN], miu[MM], pri[NN * 4], cnt;
int tax[MM], bs[MM], f[MM], has[MM];
bool notp[MM];
const int mod = 1e9 + 7;
int add(int x, int y) { return (x + y) % mod; }
int getmod(int x) { return (x + mod) % mod; }
void prework() {
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = add(pw[i - 1], pw[i - 1]);
  miu[1] = 1;
  for (int i = 2; i <= maxx; i++) {
    if (!notp[i]) {
      pri[++cnt] = i;
      miu[i] = -1;
    }
    for (int j = 1; j <= cnt && i * pri[j] <= maxx; j++) {
      notp[i * pri[j]] = true;
      if (i % pri[j] == 0) {
        miu[i * pri[j]] = 0;
        break;
      }
      miu[i * pri[j]] = -miu[i];
    }
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    int x = read();
    maxx = max(maxx, x);
    tax[x]++;
  }
  prework();
  for (int i = maxx; i; i--)
    for (int j = i; j <= maxx; j += i) {
      bs[i] += tax[j];
    }
  for (int i = maxx; i; i--) {
    f[i] = (pw[bs[i]] - 1 + mod) % mod;
    for (int j = i + i; j <= maxx; j += i) {
      f[i] = (f[i] - f[j] + mod) % mod;
    }
  }
  for (int i = 1; i <= maxx; i++)
    for (int j = i; j <= maxx; j += i) {
      has[j] = add(has[j], 1LL * getmod(miu[i]) * bs[i] % mod);
    }
  int ans = 0;
  for (int i = 2; i <= maxx; i++) {
    ans = add(ans, 1LL * has[i] * f[i] % mod);
  }
  printf("%d\n", ans);
  return 0;
}
