#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000, maxv = 1000000, p = 1e9 + 7;
int n, vv, num[maxv + 20];
long long f[maxv + 20], ans, bi[maxn + 20];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &vv);
    num[vv]++;
  }
  for (int i = 1; i <= maxv; i++)
    for (int j = i + i; j <= maxv; j += i) num[i] += num[j];
  bi[0] = 1;
  for (int i = 1; i <= n; i++) bi[i] = bi[i - 1] * 2 % p;
  for (int i = 1; i <= maxv; i++)
    if (num[i]) f[i] = bi[num[i] - 1] * (long long)num[i] % p;
  for (int i = maxv; i >= 1; i--)
    for (int j = i + i; j <= maxv; j += i) {
      f[i] -= f[j];
      if (f[i] < 0) f[i] += p;
    }
  for (int i = 2; i <= maxv; i++) ans += i * f[i] % p;
  ans %= p;
  printf("%lld\n", ans);
  return 0;
}
