#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7, Base = 998244353;
const long long N = 1e5 + 7;
const long long INF = 1LL * 1000 * 1000 * 1000 * 1000 * 1000 * 1000 + 7LL;
const double pie = acos(-1.0);
long long n, a[N], Occ[N], CoP_, Pow2[N];
vector<long long> Prime[N];
void Facto() {
  for (long long i = 2; i < N; ++i) {
    if (Prime[i].size() == 0) {
      for (long long j = i; j < N; j += i) Prime[j].push_back(i);
    }
  }
}
void Add(long long &a, long long b) {
  a += b;
  if (a < 0) a += MOD;
  if (a >= MOD) a -= MOD;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Facto();
  Pow2[0] = 1;
  for (long long i = 1; i < N; ++i) Pow2[i] = Pow2[i - 1] * 2 % MOD;
  cin >> n;
  for (long long i = 1; i <= n; ++i) {
    cin >> a[i];
    long long v = 1;
    for (long long x = 1; x < (1 << (long long)Prime[a[i]].size()); ++x) {
      v = 1;
      for (long long j = 0; j < Prime[a[i]].size(); ++j) {
        if (x & (1 << j)) {
          v *= Prime[a[i]][j];
        }
      }
      Occ[v]++;
    }
  }
  for (long long i = 1; i <= n; ++i) {
    long long v = 1, Inclusion_Exclusion = 0, cnt = 0;
    for (long long x = 1;
         x < (1 << (long long)Prime[a[i]].size()) && Prime[a[i]].size(); ++x) {
      cnt = 0;
      v = 1;
      for (long long j = 0; j < Prime[a[i]].size(); ++j) {
        if (x & (1 << j)) {
          v *= Prime[a[i]][j];
          ++cnt;
        }
      }
      if (cnt & 1) {
        Inclusion_Exclusion += Pow2[Occ[v] - 1];
      } else {
        Inclusion_Exclusion += -Pow2[Occ[v] - 1];
      }
      Occ[v]--;
    }
    Add(CoP_, Inclusion_Exclusion);
  }
  cout << (Pow2[n] - 1 - CoP_ + 5 * MOD) % MOD << '\n';
  return 0;
}
