#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int MAXN = 500006;
const int UP = 10000007;
pair<int, int> G[UP];
int A[MAXN];
int Z[UP];
vector<int> dziel(int a) {
  vector<int> E;
  while (a > 1) {
    int p = G[a].first;
    while (a % p == 0) a /= p;
    E.push_back(p);
  }
  return E;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) scanf("%d", &A[i]);
  G[1] = pair<int, int>(1, -1);
  for (int i = 2; i < UP; ++i) {
    int p = G[i].first;
    if (p == 0) {
      G[i].first = p = i;
      if (1LL * p * p < UP)
        for (int j = p * p; j < UP; j += i) G[j].first = i;
    }
    if ((i / p) % p) G[i].second = -G[i / p].second;
  }
  for (int i = 0; i < (n); ++i) {
    vector<int> P = dziel(A[i]);
    for (int ma = 0; ma < (1 << P.size()); ++ma) {
      int d = 1;
      for (int j = 0; j < (P.size()); ++j)
        if (ma & (1 << j)) d *= P[j];
      Z[d] = (Z[d] * 2 + 1) % mod;
    }
  }
  long long all = 0;
  for (int i = 0; i < (UP); ++i)
    if (i > 1) all += G[i].second * Z[i] + mod;
  all %= mod;
  ;
  long long ret = 0;
  for (int i = 0; i < (n); ++i) {
    vector<int> P = dziel(A[i]);
    long long tu = all;
    for (int ma = 0; ma < (1 << P.size()); ++ma)
      if (ma) {
        int d = 1;
        for (int j = 0; j < (P.size()); ++j)
          if (ma & (1 << j)) d *= P[j];
        tu += mod - Z[d] * G[d].second;
      }
    ret += tu;
    ;
  }
  printf("%lld\n", ret % mod);
  return 0;
}
