#include <bits/stdc++.h>
using namespace std;
int n, a[200010], mx, f[1000010], num[1000010], t[200010], c[1000010], cnt,
    fac[1000010] = {1}, inv[1000010];
inline int poww(int a, int b) {
  int r = 1;
  for (; b; b >>= 1, a = 1ll * a * a % 1000000007)
    if (b & 1) r = 1ll * r * a % 1000000007;
  return r;
}
inline int C(int a, int b) {
  return 1ll * fac[a] * inv[b] % 1000000007 * inv[a - b] % 1000000007;
}
inline void upd(int& a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]), mx = max(mx, a[i]);
    for (int j = 1; j * j <= a[i]; j++)
      if (a[i] % j == 0) {
        c[j]++;
        if (a[i] != j * j) c[a[i] / j]++;
      }
  }
  for (int i = 1; i <= mx; i++) fac[i] = 1ll * fac[i - 1] * i % 1000000007;
  inv[mx] = poww(fac[mx], 1000000007 - 2);
  for (int i = mx - 1; ~i; i--)
    inv[i] = 1ll * inv[i + 1] * (i + 1) % 1000000007;
  int ans = 0;
  for (int i = mx; i; i--) {
    cnt = c[i];
    for (int j = 1; j <= cnt; j++)
      upd(f[i], 1ll * C(cnt, j) * j % 1000000007 * i % 1000000007),
          upd(num[i], 1ll * C(cnt, j) * j % 1000000007);
    for (int j = 2; i * j <= mx; j++)
      upd(f[i], 1000000007 - 1ll * num[i * j] * i % 1000000007),
          upd(num[i], 1000000007 - num[i * j]);
    if (i ^ 1) upd(ans, f[i]);
  }
  cout << ans;
  return 0;
}
