#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int mod2 = 998244353;
long long exp(long long base, long long e, long long md);
void fact_init(int n, int md);
long long komb(int a, int b, int md);
vector<long long> fact;
vector<long long> inv_fact;
long long exp(long long base, long long e, long long md) {
  long long mul = base % md;
  long long res = 1;
  while (e) {
    if (e % 2) res = (res * mul) % md;
    e /= 2;
    mul = mul * mul % md;
  }
  return res;
}
void fact_init(int n, int md) {
  fact.resize(n + 5);
  inv_fact.resize(n + 5);
  fact[0] = inv_fact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = (fact[i - 1] * i) % md;
    inv_fact[i] = exp(fact[i], md - 2, md);
  }
}
long long komb(int a, int b, int md) {
  if (a < b) return 0;
  return fact[a] * (inv_fact[a - b] * inv_fact[b] % md) % md;
}
const int N = 1e5 + 5;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  long long cnt[N] = {};
  long long non_coprime = 0;
  long long pw2[N];
  pw2[0] = 1;
  for (int i = 1; i < N; i++) pw2[i] = pw2[i - 1] * 2 % mod;
  for (int i = 0; i < n; i++) {
    int s;
    cin >> s;
    if (s == 1) continue;
    vector<int> prime;
    for (int b = 2; b * b <= s; b++) {
      if (s % b) continue;
      prime.push_back(b);
      while (s % b == 0) s /= b;
    }
    if (s > 1) prime.push_back(s);
    int sz = prime.size();
    int M = 1 << sz;
    for (int m = 1; m < M; m++) {
      int setCnt = 0;
      int val = 1;
      for (int bit = 0; bit < sz; bit++) {
        if ((m >> bit) & 1) {
          setCnt++;
          val *= prime[bit];
        }
      }
      if (setCnt % 2 == 0)
        non_coprime = (non_coprime - (pw2[cnt[val]] - 1) + mod) % mod;
      else
        non_coprime = (non_coprime + pw2[cnt[val]] - 1 + mod) % mod;
      cnt[val]++;
    }
    non_coprime++;
    non_coprime %= mod;
  }
  cout << (pw2[n] - 1 - non_coprime + mod) % mod << "\n";
}
