#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5e5;
const int MAXV = 1e7 + 10;
const int MOD = 1e9 + 7;
inline int read() {
  int res = 0, flag = 1;
  char in = getchar();
  while (!isdigit(in)) {
    if (in == '-') flag = -1;
    in = getchar();
  }
  while (isdigit(in)) {
    res = (res << 1) + (res << 3) + in - '0';
    in = getchar();
  }
  return res * flag;
}
inline int chkmax(int &a, int b) {
  if (a < b) a = b;
  return b;
}
inline void chkmin(int &a, int b) {
  if (a > b) a = b;
}
int mu[MAXV + 10], prim[MAXV >> 3], cnt, n;
bool vis[MAXV + 10];
int b[MAXV], mul[MAXN], Max, ans;
inline void init() {
  mu[1] = 1;
  for (int i = 2; i <= MAXV; ++i) {
    if (!vis[i]) prim[++cnt] = i, mu[i] = -1;
    for (int j = 1; j <= cnt && (long long)i * prim[j] <= MAXV; ++j) {
      vis[i * prim[j]] = 1;
      if (!(i % prim[j])) break;
      mu[i * prim[j]] = -mu[i];
    }
  }
}
inline void solve() {
  n = read();
  mul[0] = 1;
  for (int i = 1; i <= n; ++i) ++b[chkmax(Max, read())];
  for (int i = 1; i <= n; ++i) mul[i] = mul[i - 1] * 2 % MOD;
  for (int i = 2; i <= Max; ++i) {
    int tmp = 0;
    for (int k = i; k <= Max; k += i) tmp += b[k];
    ans = (MOD + ans -
           (long long)mu[i] * (mul[tmp] - 1) % MOD * (n - tmp) % MOD) %
          MOD;
  }
  cout << ans << endl;
}
int main() {
  init();
  solve();
  return 0;
}
