#include <bits/stdc++.h>
using namespace std;
int const MOD = 1e9 + 7;
int const MAX = 1e6 + 5;
int const CON = 1e6;
long long cnt[MAX], b[MAX], z[MAX];
int main() {
  int n, a, ma = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a);
    cnt[a]++;
    ma = max(ma, a);
  }
  long long ans = 0, x = 1;
  for (int i = 0; i <= ma; i++) {
    b[i] = x;
    z[i] = i;
    x = (x << 1) % MOD;
  }
  for (int i = 2; i <= ma; i++) {
    for (int j = i + i; j <= ma; j += i) {
      z[j] -= z[i];
    }
  }
  for (long long i = 2; i <= ma; i++) {
    long long v = 0;
    for (int j = i; j <= ma; j += i) {
      v += cnt[j];
    }
    if (!v) {
      continue;
    }
    ans += ((v * z[i]) % MOD) * (b[v - 1] % MOD);
    ans %= MOD;
  }
  printf("%I64d\n", (ans + MOD) % MOD);
}
