#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
template <class T>
inline void umin(T &x, T y) {
  x = x < y ? x : y;
}
template <class T>
inline void umax(T &x, T y) {
  x = x > y ? x : y;
}
inline unsigned int R() {
  static unsigned int seed = 416;
  return seed ^= seed >> 5, seed ^= seed << 17, seed ^= seed >> 13;
}
const int N = 10020000, mo = 1e9 + 7;
inline void add(int &x, int y) { x = x + y < mo ? x + y : x + y - mo; }
int n, mi[505000], cnt[N], mu[N], prime[N >> 2], len;
long long res;
bool mrk[N];
void getp(int n) {
  mu[1] = 1;
  for (register int i = (2); i <= (n); i++) {
    if (!mrk[i]) prime[++len] = i, mu[i] = -1;
    for (register int j = (1); j <= (len); j++) {
      if (i * prime[j] > n) break;
      mrk[i * prime[j]] = 1;
      if (i % prime[j] == 0) break;
      mu[i * prime[j]] = -mu[i];
    }
  }
}
int main() {
  int mx = 0;
  read(n);
  for (register int i = (1); i <= (n); i++) {
    int x;
    read(x);
    cnt[x]++;
    umax(mx, x);
    if (x > 1) res++;
  }
  int sum = n;
  mi[0] = 1;
  for (register int i = (1); i <= (sum); i++) mi[i] = 2 * mi[i - 1] % mo;
  n = mx;
  getp(n);
  for (register int i = (1); i <= (n); i++)
    for (register int j = (n / i); j >= (2); j--) add(cnt[i], cnt[i * j]);
  for (register int i = (2); i <= (n); i++)
    if (mu[i])
      res = (res + (1LL * mi[cnt[i]] * (sum - cnt[i]) - sum) * (-mu[i])) % mo;
  cout << (res % mo + mo) % mo << endl;
  return 0;
}
