#include <bits/stdc++.h>
const int MAXAi = 1000005;
const int GCD_LIM = 1000000;
const int MOD = 1000000007;
int N, cnt[MAXAi] = {0}, sum[MAXAi] = {0};
inline void plus(int& x, int d) { x = (x + d) % MOD; }
inline void subtrac(int& x, int d) { x = (x + MOD - d) % MOD; }
inline int pow(int bs, int ex) {
  if (ex <= 0) return 1;
  int res = 1;
  for (; ex; ex >>= 1, bs = (long long)bs * bs % MOD)
    if (ex & 1) res = (long long)res * bs % MOD;
  return res;
}
int main() {
  scanf("%d", &N);
  int i, j, Ai, res = 0;
  for (i = 0; i < N; i++) {
    scanf("%d", &Ai);
    ++cnt[Ai];
  }
  for (i = GCD_LIM; i > 1; i--) {
    int tot = 0;
    for (j = i; j <= GCD_LIM; j += i) {
      subtrac(sum[i], sum[j]);
      tot += cnt[j];
    }
    plus(sum[i], (long long)tot * pow(2, tot - 1) % MOD);
    plus(res, (long long)i * sum[i] % MOD);
  }
  printf("%d\n", res);
  return 0;
}
