#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double eps = 1e-10;
const int inf = 2000000000;
int MOD1 = 1000000007;
int MOD2 = 1000000009;
inline bool checkBit(long long int n, long long int i) {
  return n & (1LL << i);
}
inline long long int setBit(long long int n, long long int i) {
  return n | (1LL << i);
  ;
}
inline long long int resetBit(long long int n, long long int i) {
  return n & (~(1LL << i));
}
int dx[] = {0, 0, +1, -1};
int dy[] = {+1, -1, 0, 0};
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
inline bool isLeapYear(long long int year) {
  return (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
}
inline void normal(long long int &a) {
  a %= 1000000007;
  (a < 0) && (a += 1000000007);
}
inline long long int modMul(long long int a, long long int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a * b) % 1000000007;
}
inline long long int modAdd(long long int a, long long int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  return (a + b) % 1000000007;
}
inline long long int modSub(long long int a, long long int b) {
  a %= 1000000007, b %= 1000000007;
  normal(a), normal(b);
  a -= b;
  normal(a);
  return a;
}
inline long long int modPow(long long int b, long long int p) {
  long long int r = 1LL;
  while (p) {
    if (p & 1) r = modMul(r, b);
    b = modMul(b, b);
    p >>= 1LL;
  }
  return r;
}
inline long long int modDiv(long long int a, long long int b) {
  return modMul(a, modPow(b, 1000000007 - 2));
}
bool comp(const pair<int, int> &p1, const pair<int, int> &p2) {
  return p1.second < p2.second;
}
long long int converter(string a) {
  long long int i, mul = 1, r, t, ans = 0LL;
  if (a.length() == 0) return 0;
  for (i = a.length() - 1; i >= 0; i--) {
    t = a[i] - '0';
    r = t % 10;
    ans += (mul * r);
    mul = mul * 10;
  }
  return ans;
}
vector<int> store[101005];
vector<int> prime;
bool flag[101001];
const int x = 101001;
pair<long long int, int> dp[101005];
void sieve() {
  flag[1] = 1;
  int sq = sqrt(x) + 1, val, i, j;
  for (i = 4; i <= x; i += 2) flag[i] = 1;
  for (i = 2; i <= sq; i++) {
    for (j = i; (i * j) <= x; j++) {
      flag[i * j] = 1;
    }
  }
  for (i = 2; i <= x; i++) {
    if (flag[i] != 1) prime.push_back(i);
  }
}
void pf(int val) {
  int i, t = val;
  if (flag[val] != 1) {
    store[val].push_back(val);
    return;
  }
  vector<int> temp;
  for (i = 0; i < prime.size() && val > 1; ++i) {
    while (val > 1 && val % prime[i] == 0) {
      temp.push_back(prime[i]);
      val /= prime[i];
    }
  }
  temp.erase(unique(temp.begin(), temp.end()), temp.end());
  store[t] = temp;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  sieve();
  int i, j, k, n;
  long long int tot = 0, temp = 0;
  for (i = 2; i <= 100005; i++) {
    pf(i);
    dp[i].second = 0;
    dp[i].first = 0;
  }
  cin >> n;
  long long int ans =
      modSub(modPow((long long int)2, (long long int)n), (long long int)1);
  for (i = 1; i <= n; i++) {
    long long int val, cur;
    tot = 0;
    cin >> val;
    if (val == 1) continue;
    int len = store[val].size();
    for (j = 1; j < (1 << len); ++j) {
      cur = 1;
      for (k = 0; k < len; ++k)
        if (checkBit(j, k)) cur *= store[val][k];
      if (dp[cur].second == 0)
        tot -= (dp[cur].first);
      else
        tot += dp[cur].first;
      if (tot < 0) tot += MOD1;
      tot = tot % MOD1;
      ;
      dp[cur].first *= 2;
      dp[cur].first++;
      dp[cur].first = dp[cur].first % MOD1;
      dp[cur].second = __builtin_popcount(j) % 2;
    }
    temp += tot;
    temp++;
    temp = temp % MOD1;
  }
  ans = modSub(ans, temp);
  cout << ans;
  return 0;
}
