#include <bits/stdc++.h>
using namespace std;
long long geti() {
  long long ret = 0;
  char ch = getchar(), k = 1;
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') k = 0, ch = getchar();
  while (ch >= '0' && ch <= '9') ret = ret * 10 + ch - '0', ch = getchar();
  return k ? ret : -ret;
}
const int N = 1000010;
const int mo = 1000000007;
int n, t, mx;
long long f[N], g[N], mi2[N], ans = 0;
int main() {
  n = geti();
  for (int i = 1; i <= n; i += 1) {
    t = geti();
    mx = max(mx, t);
    for (int j = 1; j * j <= t; j += 1) {
      if (t % j != 0) continue;
      f[j] += 1;
      if (j != t / j) f[t / j] += 1;
    }
  }
  mi2[0] = 1;
  for (int i = 1; i <= mx; i += 1) mi2[i] = mi2[i - 1] * 2 % mo;
  for (int i = mx; i > 1; i -= 1) {
    g[i] = f[i] * mi2[f[i] - 1] % mo;
    for (int j = 2 * i; j <= mx; j += i) {
      g[i] -= g[j];
      g[i] %= mo;
    }
    ans += i * g[i] % mo;
    ans %= mo;
  }
  cout << (ans + mo) % mo;
  return 0;
}
