#include <bits/stdc++.h>
using namespace std;
const int mx = (int)(2e6 + 100);
long long int n, p[mx], freq[mx], dp[mx];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long int i = 0, el; i < n; i++) {
    cin >> el;
    freq[el]++;
  }
  for (long long int i = 2; i < mx; i++) {
    for (long long int j = 2 * i; j < mx; j += i) {
      freq[i] += freq[j];
    }
  }
  p[0] = 1ll;
  for (long long int i = 1; i < mx; i++) {
    p[i] = (p[i - 1] * 2) % 1000000007;
  }
  long long int ans = 0ll;
  for (long long int i = mx - 1; i >= 2; i--) {
    if (freq[i] > 0) {
      dp[i] = (freq[i] * p[freq[i] - 1]) % 1000000007;
      for (long long int j = 2 * i; j < mx; j += i) {
        dp[i] = (dp[i] - dp[j] + 1000000007) % 1000000007;
      }
      ans = (ans + (i * dp[i]) % 1000000007) % 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
