#include <bits/stdc++.h>
#pragma GCC optimize("O3")
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long llinf = (1LL << 61);
const int inf = (1 << 30);
const int nmax = 1e6 + 50;
const int mod = 1e9 + 7;
using namespace std;
long long n, i, x, nr[nmax], j, ans[nmax], p[nmax], tot;
void solve(long long x) {
  if (!nr[x]) return;
  ans[x] = p[nr[x] - 1] * nr[x] % mod;
  for (long long i = 2 * x; i <= 1e6; i += x)
    ans[x] = (ans[x] - ans[i] + mod) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr.tie(0);
  cout.tie(0);
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    nr[x]++;
  }
  for (i = 2; i <= 1e6; i++)
    for (j = 2 * i; j <= 1e6; j += i) nr[i] += nr[j];
  p[0] = 1;
  for (i = 1; i <= n; i++) p[i] = (p[i - 1] * 2LL) % mod;
  for (i = 1e6; i >= 2; i--) {
    solve(i);
    tot = (tot + (ans[i] * i) % mod) % mod;
  }
  cout << tot << endl;
  return 0;
}
