#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int bin_pow(int a, int n) {
  if (n < 0) {
    return 0;
  }
  if (n == 0) {
    return 1;
  }
  if (n % 2 == 0) {
    int b = bin_pow(a, n / 2);
    return (long long)b * b % MOD;
  } else {
    return (long long)a * bin_pow(a, n - 1) % MOD;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> arr(n);
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<int> cnt(1e6 + 1);
  for (int i = 0; i < n; i++) {
    cnt[arr[i]]++;
  }
  vector<int> cnt1(1e6 + 1);
  for (int i = 1; i <= 1e6; i++) {
    for (int j = i; j <= 1e6; j += i) {
      cnt1[i] += cnt[j];
    }
  }
  vector<int> aaa(1e6 + 1);
  for (int i = 1e6; i >= 1; i--) {
    aaa[i] = (long long)cnt1[i] * bin_pow(2, cnt1[i] - 1) % MOD;
    for (int j = i * 2; j <= 1e6; j += i) {
      aaa[i] -= aaa[j];
      aaa[i] = (aaa[i] + MOD) % MOD;
    }
  }
  int ans = 0;
  for (int i = 2; i <= 1e6; i++) {
    ans += (long long)i * aaa[i] % MOD;
    ans %= MOD;
  }
  cout << ans << '\n';
  return 0;
}
