#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1e6 + 5;
long long cnt[N];
long long dp[N];
long long p2[N] = {1};
int main() {
  long long n;
  long long ans = 0;
  for (long long i = 1; i <= 200000; i++) p2[i] = (2 * p2[i - 1]) % mod;
  scanf("%lld", &n);
  for (long long i = 1, num; i <= n; i++) scanf("%lld", &num), ++cnt[num];
  for (long long i = 1000000; i >= 2; i--) {
    long long del = 0, sum = 0;
    for (long long j = i; j <= 1000000; j += i)
      del = (del + dp[j]) % mod, sum += cnt[j];
    dp[i] = ((p2[sum - 1] * sum - del + mod) % mod);
    ans = (ans + dp[i] * i) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
