#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rd(T &x) {
  x = 0;
  char c = getchar();
  int f = 1;
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 - '0' + c, c = getchar();
  x *= f;
}
const int M = 1e7 + 10, N = 5e5 + 10;
const int mod = 1e9 + 7;
int pri[M], mu[M], num;
void getpri(int n) {
  static int d[M];
  mu[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!d[i]) pri[d[i] = ++num] = i, mu[i] = -1;
    for (int j = 1; j <= d[i] && pri[j] * i <= n; ++j) {
      d[i * pri[j]] = j;
      if (j != d[i]) mu[i * pri[j]] = -mu[i];
    }
  }
}
int n, a[N], d[M], m;
int pw[N];
vector<pair<int, int> > fac;
void dfs(int u, int res = 1) {
  if (u == fac.size()) {
    d[res]++;
    return;
  }
  for (int j = 0; j <= fac[u].second; ++j) dfs(u + 1, res), res *= fac[u].first;
}
int main() {
  getpri(m = 10000000);
  rd(n);
  for (int i = 1; i <= n; ++i) {
    rd(a[i]);
    int t = a[i];
    for (int j = 1; j <= num && pri[j] * (long long)pri[j] <= t; ++j)
      if (t % pri[j] == 0) {
        int c = 0;
        while (t % pri[j] == 0) t /= pri[j], c++;
        fac.push_back(make_pair(pri[j], c));
      }
    if (t > 1) fac.push_back(make_pair(t, 1));
    dfs(0);
    fac.clear();
  }
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) pw[i] = pw[i - 1] * 2ll % mod;
  int ans1 = 0, ans2 = 0;
  for (int i = 1; i <= m; ++i)
    if (d[i]) {
      if (mu[i]) ans2 = (ans2 + mu[i] * (pw[d[i]] - 1)) % mod;
      ans1 = (ans1 + mu[i] * pw[d[i] - 1] * (long long)d[i]) % mod;
    }
  int ans = (ans1 * 2ll - ans2 * (long long)n) % mod;
  printf("%d", (ans + mod) % mod);
  return 0;
}
