#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int n, A[200005], mx;
long long dp[1000005];
long long cnt[1000005];
long long qkpow(long long a, int b) {
  long long base = a, res = 1;
  while (b) {
    if (b & 1) res = (res * base) % MOD;
    base = base * base;
    base %= MOD;
    b >>= 1;
  }
  return res;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    scanf("%d", &A[i]), cnt[A[i]]++, mx = max(A[i], mx);
  long long ans = 0;
  for (int i = mx; i >= 2; i--) {
    int res = 0;
    for (int j = 1; j * i <= mx; j++) {
      res += cnt[i * j];
    }
    if (res == 0) continue;
    dp[i] = res * qkpow(2, res - 1) % MOD;
    for (int j = 2; j * i <= mx; j++) dp[i] -= dp[i * j], dp[i] %= MOD;
    ans += 1LL * i * dp[i] % MOD;
    ans %= MOD;
  }
  cout << (ans + MOD) % MOD << endl;
  return 0;
}
