#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int a[200005], cnt[1000005], dp[1000005];
int pow2[200005];
void init(int m) {
  pow2[0] = 1;
  for (int i = 1; i <= m; i++) pow2[i] = (pow2[i - 1] << 1) % mod;
}
int main() {
  int n, Max = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    cnt[a[i]]++;
    Max = max(a[i], Max);
  }
  init(n);
  int ans = 0;
  for (int i = Max; i >= 2; i--) {
    int now = 0;
    for (int j = i; j <= Max; j += i) now += cnt[j];
    if (now == 0) continue;
    dp[i] = (long long)pow2[now - 1] * now % mod;
    for (int j = i * 2; j <= Max; j += i) (dp[i] -= dp[j]) %= mod;
    (ans += (long long)i * dp[i] % mod) %= mod;
  }
  cout << (ans + mod) % mod << endl;
  return 0;
}
