#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int cnt[1000005], n;
long long Two[200005], dp[1000005];
void Init() {
  Two[0] = 1;
  for (int i = 1; i < 200005; i++) Two[i] = (Two[i - 1] << 1) % mod;
}
int main() {
  scanf("%d", &n);
  Init();
  int mx = 0;
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    mx = max(mx, x);
    cnt[x]++;
  }
  long long ans = 0;
  for (int i = mx; i > 1; i--) {
    int all = 0;
    for (int j = i; j <= mx; j += i) all += cnt[j];
    if (all == 0) continue;
    dp[i] = 1LL * all * Two[all - 1] % mod;
    for (int j = i + i; j <= mx; j += i)
      dp[i] = ((dp[i] - dp[j]) % mod + mod) % mod;
    ans = (ans + 1LL * dp[i] * i % mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
