#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long a[1001000], f[1001000], pw[1001000];
int main() {
  pw[0] = 1;
  for (long long i = 1; i < 1001000; i++) pw[i] = pw[i - 1] * 2 % MOD;
  long long n;
  scanf("%I64d", &n);
  for (long long i = 0; i < n; i++) {
    long long x;
    scanf("%I64d", &x);
    a[x]++;
  }
  long long res = 0;
  for (long long gcd = 1001000 - 1; gcd > 1; gcd--) {
    long long cnt = 0;
    for (long long i = gcd; i < 1001000; i += gcd) cnt += a[i];
    if (cnt) {
      f[gcd] = cnt * pw[cnt - 1] % MOD;
      for (long long i = 2 * gcd; i < 1001000; i += gcd)
        f[gcd] = (f[gcd] + MOD - f[i]) % MOD;
      res = (res + gcd * f[gcd] % MOD) % MOD;
    }
  }
  printf("%I64d", res);
  return 0;
}
