#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T &u) {
  u = 0;
  char c = getchar();
  long long flag = 0;
  while (c < '0' || c > '9') flag |= (c == '-'), c = getchar();
  while (c >= '0' && c <= '9')
    u = (u << 3) + (u << 1) + (c ^ 48), c = getchar();
  if (flag) u = -u;
}
template <class T>
void write(T u) {
  if (u < 0) printf("-"), u = -u;
  if (u < 10)
    putchar(48 + u);
  else
    write(u / 10), putchar(48 + u % 10);
}
template <class T, class... Arg>
void read(T &u, Arg &...v) {
  read(u);
  read(v...);
}
template <class T>
void write(T u, char c) {
  write(u);
  putchar(c);
}
template <class T>
bool checkmin(T &a, T b) {
  return (b < a ? a = b, 1 : 0);
}
template <class T>
bool checkmax(T &a, T b) {
  return (b > a ? a = b, 1 : 0);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T _max(T a, T b) {
  return (a > b ? a : b);
}
const long long N = 500005, M = 10000000, mod = 1000000000 + 7;
long long n, a[N], mx = 0;
long long prime[664600], top = 0;
long long cnt[M + 7], tmp[M + 7], mu[M + 7];
bool flag[M + 7];
long long qpow(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return ans;
}
void init() {
  read(n);
  for (long long i = 1; i <= n; ++i) {
    read(a[i]);
    ++cnt[a[i]];
    checkmax(mx, a[i]);
  }
  for (long long i = 1; i <= mx; ++i) {
    for (long long j = i; j <= mx; j += i) {
      tmp[i] += cnt[j];
    }
  }
  for (long long i = 2; i <= mx; ++i) {
    if (!flag[i]) {
      prime[++top] = i;
      mu[i] = -1;
    }
    for (long long j = 1; j <= top; ++j) {
      if (i * prime[j] > mx) break;
      flag[i * prime[j]] = 1;
      if (i % prime[j] == 0) {
        mu[i * prime[j]] = 0;
        break;
      }
      mu[i * prime[j]] = -mu[i];
    }
  }
}
void solve() {
  long long ans = 0;
  for (long long i = 2; i <= mx; ++i) {
    ans = (ans + mod -
           mu[i] * (qpow(2LL, tmp[i], mod) + mod - 1) % mod * (n - tmp[i]) %
               mod) %
          mod;
  }
  printf("%lld\n", ans);
}
int main() {
  int T = 1;
  while (T--) {
    init();
    solve();
  }
  return 0;
}
