#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7, N = 1000002;
int tot[N], num[N], f[N], ans, i, j, n, mx, a[N], pw[N];
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]), mx = max(mx, a[i]), num[a[i]]++;
  pw[0] = 1;
  for (i = 1; i <= mx; i++) pw[i] = pw[i - 1] * 2 % M;
  for (i = 2; i <= mx; i++)
    for (j = i; j <= mx; j += i) tot[i] += num[j];
  for (i = mx; i >= 2; i--) {
    if (tot[i]) f[i] = 1ll * tot[i] * pw[tot[i] - 1] % M;
    for (j = i * 2; j <= mx; j += i) (f[i] -= f[j]) %= M;
    (ans += 1ll * f[i] * i % M) %= M;
  }
  printf("%d", (ans + M) % M);
}
