#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
int a[N], noprime[N], p[N], mu[N], ans[N];
int qpow(int x, int y) {
  int ans = 1;
  while (y) {
    if (y % 2) ans = 1ll * ans * x % mod;
    x = 1ll * x * x % mod;
    y /= 2;
  }
  return ans;
}
void get_mu(int MAX) {
  int pnum = 0;
  mu[1] = 1;
  for (int i = 2; i <= MAX; i++) {
    if (!noprime[i]) {
      p[pnum++] = i;
      mu[i] = -1;
    }
    for (int j = 0; j < pnum && i * p[j] <= MAX; j++) {
      noprime[i * p[j]] = 1;
      if (i % p[j] == 0) {
        mu[i * p[j]] = 0;
        break;
      }
      mu[i * p[j]] = -mu[i];
    }
  }
}
int main() {
  int n, t, mx = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &t);
    a[t]++;
    mx = max(mx, t);
  }
  get_mu(mx);
  for (int i = 2; i <= mx; i++) {
    int res = 0;
    for (int j = i; j <= mx; j += i) {
      res += a[j];
    }
    a[i] = 1ll * res * qpow(2, res - 1) % mod;
  }
  for (int i = 2; i <= mx; i++) {
    for (int j = i; j <= mx; j += i) {
      ans[i] = ((ans[i] + mu[j / i] * a[j] % mod) % mod + mod) % mod;
    }
  }
  int ANS = 0;
  for (int i = 2; i <= mx; i++) {
    ANS = (ANS + 1ll * ans[i] * i) % mod;
  }
  printf("%d\n", ANS);
  return 0;
}
