#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 10000000;
int n;
int c[N + 1];
int f[N + 1];
int prm[N + 1], pcnt;
bool vis[N + 1];
int mu[N + 1];
void sieve() {
  mu[1] = 1;
  for (int i = 2; i <= N; i++) {
    if (!vis[i]) prm[++pcnt] = i, mu[i] = -1;
    for (int j = 1; j <= pcnt; j++) {
      int x = prm[j];
      if (1ll * i * x > N) break;
      vis[i * x] = true;
      if (i % x)
        mu[i * x] = -mu[i];
      else
        break;
    }
  }
}
int pw[N + 1];
int main() {
  pw[0] = 1;
  for (int i = 1; i <= N; i++) pw[i] = 2 * pw[i - 1] % mod;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    c[x]++;
  }
  sieve();
  for (int i = 1; i <= N; i++) f[i] = c[i];
  for (int i = 1; i <= pcnt; i++) {
    for (int j = N / prm[i]; j; j--) f[j] = (f[j] + f[j * prm[i]]) % mod;
  }
  for (int i = 1; i <= N; i++)
    (ans += 1ll * mu[i] * (pw[f[i]] - 1) * (f[i] - n) % mod) %= mod;
  cout << (ans + mod) % mod;
  return 0;
}
