#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int maxn = 1e6 + 7;
const int N = 1e7 + 7;
const int mod = 1e9 + 7;
int n;
int a[maxn];
int hav[N];
int mu[N];
int pr[maxn];
int num;
int vis[N];
int cnt[N];
long long qb[maxn];
int mx;
long long ans = 0;
void qmod() {
  qb[0] = 1;
  for (int i = 1; i < maxn; i++) qb[i] = qb[i - 1] * 2 % mod;
}
void ini() {
  mu[1] = 1;
  for (int i = 2; i < N; i++) {
    if (!vis[i]) {
      pr[num++] = i;
      mu[i] = -1;
    }
    for (int j = 0; j < num && i * pr[j] < N; j++) {
      vis[i * pr[j]] = 1;
      if (i % pr[j])
        mu[i * pr[j]] = -mu[i];
      else {
        mu[i * pr[j]] = 0;
        break;
      }
    }
  }
}
void work() {
  ans = qb[n];
  for (int i = 2; i < mx + 1; i++) {
    if (mu[i] == 0) continue;
    for (int j = i; j < mx + 1; j += i) cnt[i] += hav[j];
    if (!cnt[i]) continue;
    ans = ((ans + mu[i] * (qb[cnt[i]] - 1)) % mod + mod) % mod;
  }
  ans = ((qb[n] - ans) % mod + mod) % mod;
}
void solve() {
  ans = ans * n % mod;
  for (int i = 2; i < mx + 1; i++) {
    if (!mu[i]) continue;
    if (!cnt[i]) continue;
    ans = ((ans + mu[i] * (qb[cnt[i]] - 1) * cnt[i] % mod) % mod + mod) % mod;
  }
  printf("%lld\n", ans);
}
int main() {
  ini();
  qmod();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    hav[a[i]]++;
    mx = max(a[i], mx);
  }
  work();
  solve();
  return 0;
}
