#include <bits/stdc++.h>
using namespace std;
const long long MOD(1000000007);
long long e2[200011], f[1000011];
int ca[1000011], cma[1000011];
int main() {
  int n, i, j, ma(0);
  long long ans(0);
  scanf("%d", &n);
  e2[0] = 1;
  for (i = 1; i < n + 5; ++i) e2[i] = (e2[i - 1] << 1) % MOD;
  for (i = 0; i < n; ++i) {
    scanf("%d", &j);
    ++ca[j];
    if (ma < j) ma = j;
  }
  for (i = 2; i <= ma; ++i)
    for (j = i; j <= ma; j += i) cma[i] += ca[j];
  for (i = ma; i > 1; --i)
    if (cma[i]) {
      f[i] = e2[cma[i] - 1] * cma[i] % MOD;
      for (j = i << 1; j <= ma; j += i) f[i] -= f[j];
      if ((f[i] %= MOD) < 0) f[i] += MOD;
      ans = (ans + i * f[i]) % MOD;
    }
  printf("%I64d\n", ans);
  return 0;
}
