#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 5;
const long long MOD = 1e9 + 7;
long long n, finans = 0;
long long a[N], f[N], mult[N], ans[N];
long long pow(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    f[a[i]]++;
  }
  for (long long i = 1; i < N; i++) {
    for (long long j = 1; i * j < N; j++) mult[i] += f[i * j];
  }
  for (long long i = N - 1; i >= 2; i--) {
    long long n = mult[i];
    ans[i] = n * pow(2LL, n - 1, MOD);
    ans[i] %= MOD;
    for (long long j = 2; i * j < N; j++) {
      ans[i] -= ans[i * j];
      ans[i] += MOD;
      ans[i] %= MOD;
    }
    finans += i * ans[i];
    finans %= MOD;
  }
  cout << finans;
  return 0;
}
