#include <bits/stdc++.h>
using namespace std;
const int N = 1000001;
const int MOD = 1e9 + 7;
int cnt[N];
long long dp[N];
long long p2(int power) {
  long long res = 1;
  long long base = 2;
  while (power > 0) {
    if (power & 1) res = res * base % MOD;
    base = base * 1LL * base % MOD;
    power /= 2;
  }
  return res;
}
int calc(int n) { return n * 1LL * p2(n - 1) % MOD; }
int main() {
  int n, a;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    cnt[a]++;
  }
  for (int i = 2; i < N; ++i) {
    for (int j = i * 2; j < N; j += i) {
      cnt[i] += cnt[j];
    }
  }
  long long ans = 0;
  for (int i = N - 1; i > 1; --i) {
    dp[i] = calc(cnt[i]);
    for (int j = i * 2; j < N; j += i) {
      dp[i] = (MOD - dp[j] + dp[i]) % MOD;
    }
    ans = (ans + i * dp[i]) % MOD;
  }
  printf("%lld", ans);
  return 0;
}
