#include <bits/stdc++.h>
using namespace std;
long long n, arr[1000005], gcd[1000005], ans = 0, tw[1000005];
long long subsets[1000005];
void solve(long long n) {
  long long arrMax = 0;
  for (long long i = 0; i < n; i++) {
    arrMax = max(arrMax, arr[i]);
    subsets[arr[i]]++;
  }
  for (long long i = 1; i <= arrMax; i++) {
    for (long long j = 2; j * i <= arrMax; j++) {
      subsets[i] += subsets[i * j];
    }
  }
  for (long long i = arrMax; i > 1; i--) {
    long long subs = 0;
    for (long long j = 2; j * i <= arrMax; j++) {
      subs += subsets[i * j];
      subs %= 1000000007;
    }
    if (subsets[i]) subsets[i] = (tw[subsets[i] - 1] * subsets[i]) % 1000000007;
    subsets[i] %= 1000000007;
    subsets[i] -= subs;
    subsets[i] %= 1000000007;
    subsets[i] = (subsets[i] + 1000000007) % 1000000007;
    ans += (subsets[i] * i) % 1000000007;
    ans %= 1000000007;
  }
}
int main() {
  ios::sync_with_stdio(false);
  tw[0] = 1;
  for (long long i = 1; i < 1000005; i++) tw[i] = (tw[i - 1] * 2) % 1000000007;
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  solve(n);
  cout << ans << "\n";
  return 0;
}
