#include <bits/stdc++.h>
using namespace std;
long long pow2[10001000], ans;
int n, maxn;
int a[2010000];
bool isprime[10001000];
int prime[3000010];
int u[10001000];
int cnt = 0;
int uni[10010000];
void genprime(int n) {
  memset(isprime, 1, sizeof isprime);
  u[1] = 1;
  isprime[1] = 0;
  for (int i = 2; i <= n; i++) {
    if (isprime[i]) {
      prime[cnt++] = i;
      u[i] = -1;
    }
    for (int j = 0; j < cnt && (long long)i * prime[j] <= n; j++) {
      isprime[i * prime[j]] = 0;
      if (i % prime[j] == 0) break;
      u[i * prime[j]] = -u[i];
    }
  }
}
signed main() {
  scanf("%d", &n);
  pow2[0] = 1;
  for (int i = 1; i <= n; i++)
    pow2[i] = (pow2[i - 1] * 2ll) % (long long)1000000007;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), maxn = max(maxn, a[i]);
  genprime(maxn);
  for (int i = 1; i <= n; i++) uni[a[i]]++;
  for (long long i = 1; i <= maxn; i++) {
    if (!u[i]) continue;
    long long nowp = 0;
    for (long long j = i; j <= maxn; j += i) nowp += uni[j];
    long long nowans = ((((long long)u[i] * (long long)(nowp - n) *
                          (long long)(pow2[nowp] - 1ll)) %
                         (long long)1000000007) +
                        (long long)1000000007) %
                       (long long)1000000007;
    ans += nowans;
    ans %= (long long)1000000007;
  }
  printf("%lld\n", ans);
}
