#include <bits/stdc++.h>
using namespace std;
const int N = 1000010, MOD = 1e9 + 7;
int n, ans = 0, w[N], dp[N], pw[N], mx;
int main() {
  scanf("%d", &n);
  for (int i = pw[0] = 1; i <= n; i++) pw[i] = 2 * pw[i - 1] % MOD;
  for (int i = 1, x; i <= n; i++) scanf("%d", &x), mx = max(x, mx), w[x]++;
  for (int i = mx; i > 1; i--) {
    int t = 0;
    for (int j = i; j <= mx; j += i) t += w[j];
    if (!t) continue;
    dp[i] = 1LL * t * pw[t - 1] % MOD;
    for (int j = i + i; j <= mx; j += i) dp[i] = (dp[i] - dp[j] + MOD) % MOD;
    ans = (1LL * dp[i] * i + ans) % MOD;
  }
  printf("%d\n", ans);
  return 0;
}
