#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 500, mod = 1000000007;
int qmod1(int x) { return x >= mod ? x - mod : x; }
int qmod2(int x) { return x + (x >> 31 & mod); }
int prime[N / 10], mu[N], prime_cnt, f[N], g[N], cnt[N], p[N], pw[N / 20], n;
void make(int n) {
  mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!p[i]) prime[++prime_cnt] = i, mu[i] = -1;
    for (int j = 1; j <= prime_cnt && i * prime[j] <= n; j++) {
      int x = i * prime[j];
      p[x] = 1;
      if (i % prime[j])
        mu[x] = -mu[i];
      else
        break;
    }
  }
}
int main() {
  scanf("%d", &n);
  int wn = 0;
  for (int i = 1, x; i <= n; i++) scanf("%d", &x), wn = max(wn, x), cnt[x]++;
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = qmod1(pw[i - 1] << 1);
  make(wn);
  for (int i = 1; i <= prime_cnt; i++)
    for (int j = wn / prime[i]; j >= 1; j--) cnt[j] += cnt[j * prime[i]];
  for (int i = 1; i <= wn; i++)
    f[i] = pw[cnt[i]] - 1, g[i] = qmod2(cnt[i] * mu[i]);
  for (int i = 1; i <= prime_cnt; i++) {
    int lim = wn / prime[i];
    for (int j = 1, x = prime[i]; j <= lim; j++, x += prime[i])
      f[j] = qmod2(f[j] - f[x]), g[x] = qmod1(g[x] + g[j]);
  }
  int ans = 0;
  for (int i = 2; i <= wn; i++) ans = (ans + 1ll * f[i] * g[i]) % mod;
  cout << ans << endl;
}
