#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
long long pow2[1000010], a[1000010], cnt[1000010], way[1000010],
    div_by[1000010];
int main() {
  pow2[0] = 1;
  for (int i = 1; i < 1000010; ++i) pow2[i] = pow2[i - 1] * 2 % 1000000007;
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);
    memset(cnt, 0, sizeof(cnt));
    memset(div_by, 0, sizeof(div_by));
    for (int i = 0; i < n; ++i) ++cnt[a[i]];
    for (int i = 2; i < 1000010; ++i) {
      for (int j = i; j < 1000010; j += i) {
        div_by[i] += cnt[j];
      }
    }
    for (int i = 2; i < 1000010; ++i)
      if (div_by[i]) {
        way[i] = div_by[i] * pow2[div_by[i] - 1] % 1000000007;
      }
    for (int i = 1000010 - 1; i > 1; --i)
      if (div_by[i]) {
        for (int j = i + i; j < 1000010; j += i) {
          way[i] -= way[j];
          if (way[i] < 0) way[i] += 1000000007;
        }
      }
    long long ans = 0;
    for (int i = 2; i < 1000010; ++i) {
      ans += way[i] * i % 1000000007;
      ans %= 1000000007;
    }
    printf("%lld\n", ans);
  }
  return 0;
}
