#include <bits/stdc++.h>
using namespace std;
vector<int> cnt(1010101, 0);
void count(int n) {
  for (int i = 1; i * i <= n; ++i) {
    if (n % i == 0) {
      ++cnt[i];
      if (i != n / i) {
        ++cnt[n / i];
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(0);
  int n;
  cin >> n;
  int mx = -1000010000;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    mx = max(mx, a[i]);
    count(a[i]);
  }
  vector<int> pm(1010101, 1);
  for (int i = 1; i <= 1010101 - 1; ++i) {
    pm[i] = (pm[i - 1] + pm[i - 1]) % 1000000007;
  }
  long long ans = 0;
  vector<int> f(1010101, 0);
  for (int i = mx; i > 1; --i) {
    f[i] = (1ll * cnt[i] * pm[cnt[i] - 1]) % 1000000007;
    for (int j = 2; i * j <= mx; ++j) {
      f[i] = (f[i] - f[i * j]) % 1000000007;
      while (f[i] < 0) f[i] += 1000000007;
    }
    ans += (1ll * i * f[i]) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans % 1000000007;
  return 0;
}
