#include <bits/stdc++.h>
using namespace std;
const int N = (int)1e7 + 2;
const int M = (int)5e5 + 2;
const int mod = (int)1e9 + 7;
int mu[N], cnt[N];
int n, mx, x, p[M];
long long res;
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("test"
            ".inp",
            "r")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  }
  cin >> n;
  p[0] = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> x;
    mx = max(mx, x);
    ++cnt[x];
    p[i] = 2ll * p[i - 1] % mod;
  }
  mu[1] = 1;
  fill(mu + 2, mu + mx + 1, -1);
  int s;
  for (int i = 2; i <= mx; ++i) {
    s = cnt[i];
    for (int j = 2 * i; j <= mx; j += i) mu[j] -= mu[i], s += cnt[j];
    if (mu[i] != 0)
      res = (res + 1ll * (p[s] - 1) * (-mu[i]) * (n - s) % mod) % mod;
  }
  res += mod;
  cout << res % mod;
}
