#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const int maxn = 1000100;
const int mod = 1000000007;
vector<int> divs(int x) {
  vector<int> ret;
  for (long long k = 1; k * k <= x; k++) {
    if (x % k == 0) {
      ret.push_back(k);
      int k2 = x / k;
      if (k2 != k) ret.push_back(k2);
    }
  }
  return ret;
}
vector<int> d[N];
int qt[maxn];
long long fat[maxn], inv[maxn];
long long fpow(long long base, long long exp) {
  long long ret = 1;
  while (exp) {
    if (exp & 1) {
      ret = (ret * base) % mod;
    }
    base = (base * base) % mod;
    exp >>= 1;
  }
  return ret;
}
int p[maxn];
long long nck(long long n, long long k) {
  if (k > n) return 0;
  long long ret = fat[n];
  ret = (ret * inv[k]) % mod;
  ret = (ret * inv[n - k]) % mod;
  return ret;
}
long long pot[maxn];
long long res[maxn];
vector<int> pri(int x) {
  vector<int> ret;
  int y = x;
  while (p[y]) {
    ret.push_back(p[y]);
    y /= p[y];
  }
  if (y > 1 && y != x) ret.push_back(y);
  sort(begin(ret), end(ret));
  ret.resize(unique(begin(ret), end(ret)) - begin(ret));
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  for (int i = 2; i < maxn; i++) {
    if (!p[i]) {
      for (int j = i + i; j < maxn; j += i) {
        p[j] = i;
      }
    }
  }
  pot[0] = 1;
  for (int i = 1; i < maxn; i++) {
    pot[i] = (pot[i - 1] * 2) % mod;
  }
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    for (int x : divs(a)) {
      qt[x]++;
    }
  }
  long long ans = 0;
  for (int i = maxn - 1; i > 1; i--) {
    res[i] = (qt[i] * pot[qt[i] - 1]) % mod;
    for (int j = i + i; j < maxn; j += i) {
      res[i] = (res[i] - res[j]) % mod;
    }
    ans = (ans + i * res[i]) % mod;
  }
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
