#include <bits/stdc++.h>
using namespace std;
const int N = int(1e7) + 1, M = int(5e5) + 10, mod = int(1e9) + 7;
int a[M], lp[N + 10];
int mu[N + 10], n, p, m;
int b[30], c[30], cn;
long long cnt[N + 10], d[N + 20];
long long all, ans, cur;
long long modpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return res;
}
inline void rec(int x, int second) {
  if (x == cn + 1) {
    cnt[second]++;
    return;
  }
  rec(x + 1, second);
  for (int i = 1; i <= c[x]; i++) {
    second = second * b[x];
    rec(x + 1, second);
  }
}
inline void rec1(int x, int second) {
  if (x == cn + 1) {
    if (second == 1) return;
    cur = (cur + mu[second] * (d[cnt[second]] - 1)) % mod;
    if (cur < 0) cur += mod;
    return;
  }
  rec1(x + 1, second);
  for (int i = 1; i <= c[x]; i++) {
    second = second * b[x];
    rec1(x + 1, second);
  }
}
int main() {
  for (int i = 2; i <= N; i += 2) lp[i] = 2;
  int K = int(sqrt(N + 2.0));
  for (int i = 3; i <= K; i += 2)
    if (!lp[i]) {
      for (int j = i * i; j <= N; j += (i + i)) lp[j] = i;
    }
  mu[1] = -1;
  for (int i = 2; i <= N; i++) {
    p = lp[i];
    if (!p) p = i;
    if (i / p % p == 0)
      mu[i] = 0;
    else
      mu[i] = -mu[i / p];
  }
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    m = a[i];
    cn = 0;
    while (m > 1) {
      p = lp[m];
      if (!p) p = m;
      b[++cn] = p;
      c[cn] = 0;
      while (m % p == 0) {
        m /= p;
        c[cn]++;
      }
    }
    rec(1, 1);
  }
  all = 0;
  d[0] = 1;
  for (int i = 1; i <= N; i++) {
    d[i] = d[i - 1] * 2 % mod;
  }
  for (int i = 2; i <= N; i++)
    if (cnt[i] > 0) {
      all = (all + mu[i] * (d[cnt[i]] - 1)) % mod;
      if (all < 0) all += mod;
    }
  for (int i = 1; i <= n; i++) {
    m = a[i];
    cn = 0;
    while (m > 1) {
      p = lp[m];
      if (!p) p = m;
      b[++cn] = p;
      c[cn] = 0;
      while (m % p == 0) {
        c[cn]++;
        m /= p;
      }
    }
    cur = 0;
    rec1(1, 1);
    ans = (ans + all - cur) % mod;
    if (ans < 0) ans += mod;
  }
  cout << ans;
  return 0;
}
