#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010000;
const int MOD = 1e9 + 7;
int n, a[MAXN], m;
long long sum[MAXN], cnt[MAXN];
long long ksm(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long t = ksm(a, b / 2);
  t = t * t % MOD;
  if (b & 1) t = t * a % MOD;
  return t;
}
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    a[x]++;
    m = max(m, x);
  }
  long long ans = 0;
  for (int i = m; i >= 2; i--) {
    for (int j = i; j <= m; j += i) {
      sum[i] = (MOD + sum[i] - sum[j]) % MOD;
      cnt[i] += a[j];
    }
    sum[i] = (sum[i] + cnt[i] * ksm(2, cnt[i] - 1) % MOD) % MOD;
    ans = (ans + i * sum[i]) % MOD;
  }
  printf("%lld", ans);
  return 0;
}
