#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
inline int fsp(int x, int p = Mod - 2) {
  int res = 1;
  while (p) {
    if (p & 1) res = 1ll * res * x % Mod;
    x = 1ll * x * x % Mod, p >>= 1;
  }
  return res;
}
int n, m, a[500005], c[10000007], p2[500005], pri[10000007 / 10], tot,
    miu[10000007];
bool vis[10000007];
inline int MOD(const int &x) { return x >= Mod ? x - Mod : x; }
int main() {
  cin >> n;
  for (int i = p2[0] = 1; i <= n; ++i) {
    scanf("%d", a + i), ++c[a[i]];
    m = max(m, a[i]), p2[i] = 2ll * p2[i - 1] % Mod;
  }
  miu[1] = 1;
  for (int i = 2; i <= m; ++i) {
    if (!vis[i]) pri[++tot] = i, miu[i] = -1;
    for (int j = 1; j <= tot && 1ll * i * pri[j] <= m; ++j) {
      vis[i * pri[j]] = 1;
      if (i % pri[j] == 0) break;
      miu[i * pri[j]] = -miu[i];
    }
  }
  long long ans = 0;
  for (register int i = 1; i <= m; ++i) {
    for (register int j = i + i; j <= m; j += i) c[i] += c[j];
    ans = (ans + 1ll * (-miu[i]) * (n - c[i]) * (p2[c[i]] - 1)) % Mod;
  }
  if (ans < 0) ans += Mod;
  cout << ans << endl;
  return 0;
}
