#include <bits/stdc++.h>
int n;
const int mod = 1e9 + 7;
long long pow(long long a, long long x) {
  if (x == 0) return 1;
  if (x == 1) return a;
  long long t = pow(a, x >> 1) % mod;
  return t * t % mod * pow(a, x & 1) % mod;
}
int cnt[1000010], res, f[1000010], power[1000010], t[1000010];
int main() {
  scanf("%d", &n);
  power[0] = 1;
  for (int i = 1; i <= n; i++) {
    int k;
    scanf("%d", &k);
    cnt[k]++;
    power[i] = power[i - 1] << 1;
    if (power[i] >= mod) power[i] -= mod;
  }
  for (int i = 1; i <= n; i++)
    f[i] = (1ll * (f[i - 1] << 1) + power[i - 1]) % mod;
  for (int i = 2; i <= 1000000; i++) t[i] = i;
  for (int i = 2; i <= 1000000; i++) {
    for (int j = i + i; j <= 1000000; j += i) cnt[i] += cnt[j], t[j] -= t[i];
    res = (res + (1ll * f[cnt[i]] * t[i])) % mod;
  }
  printf("%d\n", res);
  return 0;
}
