#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000500;
const int N = 1000055;
bool notp[N];
int prime[N], pnum, mu[N];
void Mobius() {
  memset(notp, 0, sizeof(notp));
  mu[1] = 1;
  for (int i = 2; i < N; i++) {
    if (!notp[i]) prime[++pnum] = i, mu[i] = -1;
    for (int j = 1; prime[j] * i < N; j++) {
      notp[prime[j] * i] = 1;
      if (i % prime[j] == 0) {
        mu[prime[j] * i] = 0;
        break;
      }
      mu[prime[j] * i] = -mu[i];
    }
  }
}
int const Max_N = 1e6 + 10;
long long mod = 1e9 + 7;
long long cnt[Max_N];
long long f[Max_N];
long long g[Max_N];
long long Pow[Max_N];
void init() {
  Pow[0] = 1;
  for (int i = 1; i < Max_N; ++i) Pow[i] = Pow[i - 1] * 2 % mod;
}
int main() {
  int T;
  int a, b, c, d, k;
  Mobius();
  init();
  int n, num;
  scanf("%d", &n);
  int mx = 0;
  for (int i = 0; i < n; ++i) scanf("%d", &num), cnt[num]++, mx = max(mx, num);
  for (int i = 2; i < Max_N; ++i) {
    for (int j = i * 2; j < Max_N; j += i) cnt[i] += cnt[j];
    if (cnt[i]) f[i] = Pow[cnt[i] - 1] * cnt[i] % mod;
  }
  long long ans = 0;
  int Mx = mx;
  for (int i = 2; i <= Mx; ++i) {
    for (int j = i; j <= Mx; j += i) {
      g[i] = (g[i] + mu[j / i] * f[j] + mod) % mod;
    }
  }
  for (int i = 2; i <= Mx; ++i) {
    ans = (ans + i * g[i] + mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
