#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 100 * 1000 + 10;
const long long MOD = 1e9 + 7;
long long a[N], cnt[N * 5], ans[N * 5], p[N * 5], res;
long long f(long long v) {
  if (v == 0) return 0;
  return (p[v - 1] * v) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  p[0] = 1LL;
  for (int i = 1; i <= 1000000; i++) {
    p[i] = 2LL * p[i - 1];
    p[i] %= MOD;
  }
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = 1; i <= 1000000; i++) {
    for (int j = 2 * i; j <= 1000000; j += i) cnt[i] += cnt[j];
  }
  for (int i = 1; i <= 1000000; i++) ans[i] = f(cnt[i]);
  for (int i = 1000000; i >= 2; i--) {
    for (int j = i * 2; j <= 1000000; j += i) {
      ans[i] = (ans[i] - ans[j] + MOD) % MOD;
    }
    res += i * ans[i];
    res %= MOD;
  }
  cout << res;
  return 0;
}
