#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int M = 1e6 + 5;
const int N = 2e5 + 5;
int cnt[M];
long long res[M];
int n, m;
long long ans;
long long q_pow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    cnt[x]++;
  }
  for (int i = 1000000; i >= 2; i--) {
    int c = 0;
    for (int j = i; j <= 1000000; j += i) c += cnt[j];
    if (c == 0) continue;
    res[i] = (q_pow(2, c - 1) * c) % mod;
    for (int j = 2 * i; j <= 1000000; j += i)
      if (res[j] != 0) res[i] = (res[i] - res[j] + mod) % mod;
    ans = (ans + (res[i] * (long long)i) % mod) % mod;
  }
  cout << ans;
}
