#include <bits/stdc++.h>
using namespace std;
long long a[200000], cnt[1000001], ans[1000001], f[1000001];
long long p[1000001];
signed main() {
  long long n;
  cin >> n;
  fill(f, f + 1000001, 0);
  for (long long i = 0; i < (long long)(n); ++i) {
    cin >> a[i];
    ++f[a[i]];
  }
  for (long long i = 2; i < 1000001; ++i)
    for (long long m = i; m < 1000001; m += i) cnt[i] += f[m];
  p[0] = 1;
  for (long long i = 1; i < 1000001; ++i) {
    p[i] = (2 * p[i - 1]) % 1000000007;
  }
  long long sum = 0;
  for (long long i = 1000001 - 1; i >= 2; --i) {
    if (cnt[i]) ans[i] = (cnt[i] * p[cnt[i] - 1]) % 1000000007;
    for (long long m = 2 * i; m < 1000001; m += i)
      ans[i] = (ans[i] - ans[m] + 1000000007) % 1000000007;
    sum = (sum + i * ans[i]) % 1000000007;
  }
  cout << sum << endl;
}
