#include <bits/stdc++.h>
using namespace std;
const int maxN = 300010, modP = 1e9 + 7, oo = 23041997, maxB = 600;
const double PI = acos(-1);
int prime[maxN], a[maxN], cnt[maxN], n, POW[maxN], res, p[maxN], maxv;
void sieve() {
  for (int i = 2; i <= maxv; ++i)
    if (prime[i] == 0) {
      int s = 2 * i;
      while (s <= maxv) {
        prime[s] = i;
        s += i;
      }
    }
}
void factorize(int x) {
  p[0] = 0;
  while (prime[x]) {
    p[++p[0]] = prime[x];
    x /= prime[x];
  }
  p[++p[0]] = x;
}
int main() {
  cin >> n;
  maxv = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    maxv = max(maxv, a[i]);
    for (int j = 1; j <= (int)sqrt(a[i]); ++j)
      if (a[i] % j == 0) {
        ++cnt[j];
        if (a[i] / j != j) ++cnt[a[i] / j];
      }
  }
  POW[0] = 1;
  for (int i = 1; i <= n; ++i) POW[i] = (1ll * POW[i - 1] * 2) % modP;
  sieve();
  res = POW[n] - 1;
  for (int i = 2; i <= maxv; ++i) {
    factorize(i);
    bool check = true;
    for (int j = 2; j <= p[0]; ++j)
      if (p[j] == p[j - 1]) check = false;
    if (check && cnt[i]) {
      int tmp = (((POW[cnt[i]] - 1) % modP) + modP) % modP;
      if ((p[0] % 2) == 0)
        res = (res + tmp) % modP;
      else
        res = (((res - tmp) % modP) + modP) % modP;
    }
  }
  cout << res;
}
