#include <bits/stdc++.h>
using namespace std;
const long long P = 1e9 + 7;
long long n, ans;
long long a[200009];
long long pr[1000009];
long long s[1000009];
long long c[1000009];
int main() {
  pr[0] = 1;
  for (long long i = 1; i <= 1000000; i++) pr[i] = (pr[i - 1] * 2) % P;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    long long k = a[i];
    long long p = sqrt(k);
    for (long long j = 1; j <= p; j++) {
      if (k % j == 0) {
        s[j]++;
        if (j * j != k) s[k / j]++;
      }
    }
  }
  for (long long i = 1000000; i > 1; i--) {
    if (!s[i]) continue;
    long long an = (s[i] * pr[s[i] - 1] - c[i] + P) % P;
    ans = (ans + an * i) % P;
    long long k = i;
    long long p = sqrt(k);
    for (long long j = 2; j <= p; j++) {
      if (k % j == 0) {
        c[j] = (c[j] + an) % P;
        if (j * j != k) {
          c[k / j] = (c[k / j] + an) % P;
        }
      }
    }
  }
  printf("%lld\n", ans);
  return 0;
}
