#include <bits/stdc++.h>
using namespace std;
using namespace std;
;
int n;
long long mod = 1000 * 1000 * 1000 + 7;
const int maxn = 1000005;
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long d[maxn];
long long cnt[maxn];
long long pow2[maxn];
long long coef[maxn];
long long bad[maxn];
int main() {
  pow2[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    pow2[i] = pow2[i - 1] * 2;
    pow2[i] %= mod;
  }
  cin >> n;
  vector<int> v;
  v.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &v[i]);
    cnt[v[i]]++;
  }
  for (int i = 2; i < maxn; ++i) {
    for (int j = i; j < maxn; j += i) {
      d[i] += cnt[j];
      if (i != j) bad[j] += i;
      bad[j] %= mod;
    }
  }
  long long ans = 0;
  for (int i = maxn - 1; i >= 2; --i) {
    if (d[i] == 0) continue;
    coef[i] = (1LL * ((d[i] * pow2[d[i] - 1]) % mod)) % mod;
    for (int j = i * 2; j < maxn; j += i) coef[i] -= coef[j];
    ans += i * coef[i];
    ans %= mod;
    ans += mod;
    ans %= mod;
  }
  cout << ans << "\n";
}
