#include <bits/stdc++.h>
long long n;
long long m = 0;
long long pricnt = 0;
bool visited[10000001];
long long prime[10000001];
long long mu[10000001];
long long c[10000001];
long long num[500001];
long long ans = 0;
void sieve() {
  visited[1] = true;
  for (long long i = 1; i < 10000001; i++) {
    if (!visited[i]) {
      prime[++pricnt] = i;
      mu[i] = 1000000007 - 1;
    }
    for (long long j = 1; j <= pricnt && i * prime[j] < 10000001; j++) {
      visited[i * prime[j]] = true;
      if (i % prime[j] != 0) {
        mu[i * prime[j]] = (1000000007 - mu[i]) % 1000000007;
      } else {
        break;
      }
    }
  }
}
signed main() {
  sieve();
  scanf("%lld", &n);
  num[0] = 1;
  for (long long i = 1; i <= n; i++) {
    long long x;
    scanf("%lld", &x);
    m = std::max(m, x);
    c[x]++;
    num[i] = num[i - 1] * 2 % 1000000007;
  }
  for (long long i = 1; i <= m; i++) {
    long long cnt = 0;
    for (long long j = i; j <= m; j += i) {
      cnt += c[j];
    }
    ans = (ans + (1000000007 - mu[i]) % 1000000007 * (n - cnt) % 1000000007 *
                     (num[cnt] - 1) % 1000000007) %
          1000000007;
  }
  printf("%lld\n", ans);
  return 0;
}
