#include <bits/stdc++.h>
using namespace std;
long long n, x, i[1000010], maks = 1000000, cnt[1000010], ans[1000010],
                            mod = 1e9 + 7, ansik;
long long pot[1000010];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int a = 1; a <= n; a++) {
    cin >> x;
    i[x]++;
  }
  for (int a = 1; a <= maks; a++) {
    cnt[a] = i[a];
    for (int b = a + a; b <= maks; b += a) cnt[a] += i[b], cnt[a] %= mod;
  }
  pot[0] = 1;
  for (int a = 1; a <= maks; a++) pot[a] = 2 * pot[a - 1], pot[a] %= mod;
  for (int a = maks; a >= 1; a--) {
    if (cnt[a] == 0) continue;
    ans[a] = cnt[a] * (pot[cnt[a] - 1]);
    ans[a] %= mod;
    for (int b = a + a; b <= maks; b += a)
      ans[a] -= ans[b], ans[a] += mod, ans[a] %= mod;
  }
  for (int a = 2; a <= maks; a++) ansik += a * ans[a], ansik %= mod;
  cout << ansik;
  return 0;
}
