#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
long long num[maxm], fac[maxn] = {1, 2};
int main(void) {
  int n;
  for (int i = 2; i < maxn; i++) fac[i] = fac[i - 1] * 2 % mod;
  while (cin >> n) {
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
      int x;
      scanf("%d", &x);
      num[x]++;
    }
    for (int i = 2; i < maxm; i++)
      for (int j = i * 2; j < maxm; j += i) num[i] += num[j];
    for (int i = 2; i < maxm; i++) num[i] = fac[num[i] - 1] * num[i] % mod;
    long long ans = 0;
    for (int i = maxm - 1; i >= 2; i--)
      for (int j = i * 2; j < maxm; j += i) num[i] -= num[j];
    for (int i = 2; i < maxm; i++) ans = (ans + num[i] * i) % mod;
    printf("%I64d\n", ans);
  }
  return 0;
}
