#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1100000;
const long long mod = 1e9 + 7;
long long mul(long long a, long long b) {
  a *= b;
  a = a % mod;
  a += mod;
  a %= mod;
  return a;
}
long long add(long long a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
  return a;
}
bool tag[maxn];
long long p[maxn / 10];
long long mob[maxn];
long long cnt;
void GetPrime() {
  cnt = 0;
  mob[1] = 1;
  for (long long i = 2; i < maxn; i++) {
    if (!tag[i]) {
      p[cnt++] = i;
      mob[i] = -1;
    }
    for (long long j = 0; j < cnt && p[j] * i < maxn; j++) {
      tag[i * p[j]] = 1;
      if (i % p[j] == 0) {
        mob[i * p[j]] = 0;
        break;
      }
      mob[i * p[j]] = -mob[i];
    }
  }
}
long long F[maxn], f[maxn];
struct ASSWECAN {
  long long n;
  long long cnt[maxn];
  long long pow2[maxn];
  long long ans[maxn];
  void solve() {
    scanf("%d", &n);
    for (long long i = 1; i <= n; i++) {
      long long v;
      scanf("%d", &v);
      cnt[v]++;
    }
    GetPrime();
    pow2[0] = 1;
    for (long long i = 1; i <= 1000000; i++) pow2[i] = mul(pow2[i - 1], 2);
    for (long long i = 2; i <= 1000000; i++) {
      long long s = 0;
      for (long long j = i; j <= 1000000; j += i) s += cnt[j];
      if (s) {
        F[i] = mul(s, pow2[s - 1]);
      }
    }
    for (long long i = 1; i <= 1000000; i++) {
      for (long long j = i; j <= 1000000; j += i)
        f[i] = add(mul(mob[j / i], F[j]), f[i]);
    }
    long long res = 0;
    for (long long i = 2; i <= 1000000; i++) res = add(res, mul(f[i], i));
    printf("%lld\n", res);
  }
} solver;
int main() {
  solver.solve();
  return 0;
}
