#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
const int MOD = 1e9 + 7;
int inc(int a, int b) {
  if ((a += b) >= MOD) a -= MOD;
  return a;
}
int mul(int a, int b) { return 1ll * a * b % MOD; }
int n, cnt[N], dp[N], po[N];
void solve() {
  fill_n(cnt, N, 0);
  for (int i = (0); i < (n); ++i) {
    int d;
    scanf("%d", &d);
    cnt[d]++;
  }
  int ans = 0;
  for (int d = (N)-1; d >= (2); --d) {
    int sum = 0;
    for (int i = d; i < N; i += d) sum += cnt[i];
    if (!sum) continue;
    dp[d] = mul(sum, po[sum - 1]);
    for (int i = d + d; i < N; i += d) dp[d] = inc(dp[d], MOD - dp[i]);
    ans = inc(ans, mul(dp[d], d));
  }
  printf("%d\n", ans);
}
int main() {
  po[0] = 1;
  for (int i = (1); i < (N); ++i) po[i] = inc(po[i - 1], po[i - 1]);
  while (~scanf("%d", &n)) solve();
  return 0;
}
