#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 44;
const long long M = 2e5 + 44;
const long long mod = 1000000007;
const long long maxn = 1e6 + 44;
long long s[M];
long long ans, n;
long long mp[N];
bool vis[maxn];
long long prime[maxn], mu[maxn];
long long cnt;
long long pw[N];
void getMu() {
  long long N = maxn;
  for (long long i = 1; i < N; ++i) {
    long long target = i == 1 ? 1 : 0;
    long long delta = target - mu[i];
    mu[i] = delta;
    for (long long j = 2 * i; j < N; j += i) mu[j] += delta;
  }
}
void solve() {
  long long i, j;
  ans = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j * j <= s[i]; j++)
      if (s[i] % j == 0) {
        mp[j] = (mp[j] + 1) % mod;
        if (j * j != s[i]) mp[s[i] / j] = (mp[s[i] / j] + 1) % mod;
      }
  for (i = 2; i <= 1000000; i++) {
    int sum = 0;
    for (j = 1; j * i <= 1000000; j++)
      sum = (sum + mu[j] * pw[mp[i * j] - 1] * mp[i * j]) % mod;
    ans = (ans + sum * i) % mod;
  }
  cout << (ans + mod) % mod << endl;
}
void init() {
  int i, j;
  getMu();
  memset(mp, 0, sizeof(mp));
  pw[0] = 1;
  for (i = 1; i <= 1000000; i++) pw[i] = (pw[i - 1] * 2) % mod;
}
int main() {
  long long i, j;
  init();
  scanf("%I64d", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &s[i]);
  sort(s + 1, s + n + 1);
  solve();
  return 0;
}
