#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 500000 + 10;
const int MAX_M = 1e7 + 10;
const int MOD = 1e9 + 7;
int a[MAX_N], n, pw[MAX_M];
int minPrime[MAX_M], prime[MAX_M], len = 1;
int cur[MAX_N], tot;
int miu[MAX_M], cnt[MAX_M];
void dfs(int p, int m, int c) {
  if (p == tot) {
    cnt[m]++;
    miu[m] = c;
    return;
  }
  dfs(p + 1, m, c);
  dfs(p + 1, m * cur[p], c * -1);
}
int main() {
  pw[0] = 1;
  for (int i = 1; i < MAX_M; i++) pw[i] = (pw[i - 1] + pw[i - 1]) % MOD;
  for (int i = 2; i < MAX_M; i++) {
    if (!minPrime[i]) {
      minPrime[i] = len;
      prime[len++] = i;
    }
    for (int j = 1; j <= minPrime[i] && prime[j] * i < MAX_M; j++)
      minPrime[prime[j] * i] = j;
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++) {
    tot = 0;
    while (int id = minPrime[a[i]]) {
      id = prime[id];
      cur[tot++] = id;
      while (a[i] % id == 0) a[i] /= id;
    }
    dfs(0, 1, 1);
  }
  int ans = 0;
  for (int i = 1; i < MAX_M; i++)
    if (miu[i]) {
      int add = miu[i] *
                (1LL * cnt[i] * pw[cnt[i]] - 1LL * (pw[cnt[i]] - 1) * n) % MOD;
      add = (add + MOD) % MOD;
      ans = (ans + add) % MOD;
    }
  printf("%d\n", ans);
  return 0;
}
