#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6;
const int mod = 1000000007;
int n;
int a[maxn + 20];
long long dp[maxn + 50];
inline int getint() {
  char c = getchar();
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  int d = (c == '-') ? (-1) : (1);
  int t = (c == '-') ? (0) : (c - '0');
  c = getchar();
  while (c >= '0' && c <= '9') {
    t = t * 10 + c - '0';
    c = getchar();
  }
  return d * t;
}
long long fast_power(int a, int b) {
  if (b == 0) return 1;
  if (b == 1) return a % mod;
  if (b % 2 == 1) return fast_power(a, b - 1) * a % mod;
  long long t = fast_power(a, b / 2);
  return (t * t) % mod;
}
int main() {
  n = getint();
  for (int i = (1); i <= (n); i++) {
    int x = getint();
    a[x]++;
  }
  long long ans = 0;
  for (int i = (maxn); i >= (2); i--) {
    int tot = 0;
    for (int j = i; j <= maxn; j += i) {
      tot += a[j];
    }
    if (tot > 0)
      dp[i] = (fast_power(2, tot - 1) * tot % mod + mod) % mod;
    else
      dp[i] = 0;
    for (int j = 2 * i; j <= maxn; j += i) {
      dp[i] -= dp[j];
      dp[i] += mod;
      dp[i] %= mod;
    }
    ans += dp[i] * i % mod;
    ans %= mod;
  }
  cout << ans % mod << endl;
  return 0;
}
