#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[(long long)(1e6 + 3)];
long long c[(long long)(1e6 + 3)];
long long d[(long long)(1e6 + 3)];
long long p[(long long)(1e6 + 3)];
vector<long long> factor(long long u) {
  vector<long long> res;
  for (long long i = 1; i * i <= u; i++) {
    if (u % i == 0) {
      if (i != 1) res.push_back(i);
      if (i * i != u && u / i != 1) res.push_back(u / i);
    }
  }
  return res;
}
void solve() {
  p[0] = 1;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    vector<long long> f = factor(a[i]);
    for (long long j = 0; j < f.size(); j++) {
      long long cur = f[j];
      c[cur]++;
    }
    p[i + 1] = (p[i] * 2) % (long long)(1e9 + 7);
  }
  long long ans = 0;
  for (long long i = (long long)(1e6 + 3) - 1; i >= 1; i--) {
    c[i] = (c[i] * p[c[i] - 1]) % (long long)(1e9 + 7);
    long long cur = i * 2;
    while (cur < (long long)(1e6 + 3)) {
      c[i] = (c[i] - c[cur] + (long long)(1e9 + 7)) % (long long)(1e9 + 7);
      cur += i;
    }
  }
  for (long long i = 2; i < (long long)(1e6 + 3); i++) {
    if (c[i]) {
      ans = (ans + c[i] * i) % (long long)(1e9 + 7);
    }
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}
