#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007, aax = 1000005, nax = 200005;
long long power(long long val, int p) {
  if (p < 0) return 0;
  long long res = 1;
  while (p) {
    if (p & 1) res = res * val % mod;
    val = val * val % mod;
    p >>= 1;
  }
  return res;
}
long long a[aax], cnt[aax], dp[aax], ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  while (n--) {
    int x;
    cin >> x;
    ++a[x];
  }
  for (int i = 1; i < aax; ++i)
    for (int j = i; j < aax; j += i) cnt[i] = (cnt[i] + a[j]) % mod;
  for (int i = aax - 1; i; --i) {
    dp[i] = cnt[i] * power(2, cnt[i] - 1) % mod;
    for (int j = i << 1; j < aax; j += i) dp[i] = (dp[i] + mod - dp[j]) % mod;
  }
  for (long long i = 2; i < aax; ++i) ans = (ans + i * dp[i]) % mod;
  cout << ans;
}
