#include <bits/stdc++.h>
inline void read(int& x) {
  char c;
  while ((c = getchar()) < '0' || c > '9')
    ;
  x = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
}
using namespace std;
const int maxn = 1e6 + 10;
const int inf = 0x7fffffff;
const long long INF = 9E18;
const int mod = 1e9 + 7;
const int eps = 1e-7;
const double pi = acos(-1.0);
int pw[maxn], mp[maxn];
long long dp[maxn];
int main() {
  int n;
  scanf("%d", &n);
  int maxx = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    read(x);
    mp[x]++;
    maxx = max(x, maxx);
  }
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = (2 * pw[i - 1]) % mod;
  int ans = 0;
  for (int i = maxx; i >= 2; i--) {
    int tmp = 0;
    for (int j = i; j <= maxx; j += i) tmp += mp[j];
    if (!tmp) continue;
    dp[i] = 1LL * tmp * pw[tmp - 1] % mod;
    for (int j = i + i; j <= maxx; j += i) dp[i] = (dp[i] - dp[j] + mod) % mod;
    ans = (1LL * dp[i] * i + ans) % mod;
  }
  printf("%d\n", ans);
  return 0;
}
