#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;
bool pf[maxn];
long long int pd[maxn];
int mask[maxn];
vector<int> pri;
vector<int> v[maxn];
int n;
long long int res;
int a[maxn];
bool pr(int u) {
  for (int i = 2; i <= sqrt(u); i++) {
    if (u % i == 0) {
      return 0;
    }
  }
  return 1;
}
long long int pw(long long int a, int b) {
  long long int pans = 1;
  while (b) {
    if (b % 2) {
      pans = (1ll * pans * a) % mod;
    }
    a = (1ll * a * a) % mod;
    b /= 2;
  }
  return pans;
}
inline void input();
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  input();
}
inline void input() {
  for (int i = 2; i <= sqrt(maxn); i++) {
    if (pr(i)) {
      pri.emplace_back(i);
    }
  }
  for (int i = 0; i < pri.size(); i++) {
    int p = pri[i];
    int o = 2;
    while (1ll * p * o < maxn) {
      pf[p * o] = 1;
      o++;
    }
  }
  pri.clear();
  for (int i = 2; i < maxn; i++) {
    if (pf[i] == 0) {
      pri.push_back(i);
    }
  }
  for (int i = 0; i < pri.size(); i++) {
    int o = pri[i];
    int k = 1;
    while (1ll * o * k < maxn) {
      v[o * k].emplace_back(o);
      k++;
    }
  }
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    res = 0;
    for (int j = 0; j < (1 << v[a[i]].size()); j++) {
      if (j == 0) {
        mask[j] = 1;
      } else {
        int u = __builtin_ffs(j);
        mask[j] = (mask[j ^ (1 << u - 1)] * v[a[i]][u - 1]);
      }
      res += pw((-1), __builtin_popcount(j)) * pw(2, pd[mask[j]]);
      res %= mod;
      res += mod;
      res %= mod;
    }
    ans += res;
    ans += mod;
    ans %= mod;
    for (int j = 0; j < (1 << v[a[i]].size()); j++) {
      if (j == 0) {
        mask[j] = 1;
      } else {
        int u = __builtin_ffs(j);
        mask[j] = (mask[j ^ (1 << u - 1)] * v[a[i]][u - 1]);
      }
      pd[mask[j]]++;
    }
  }
  cout << ans;
}
