#include <bits/stdc++.h>
using namespace std;
const long long MOD = (long long)1e9 + 7;
long long add(long long x, long long y) { return (x + y) % MOD; }
long long sub(long long x, long long y) { return (x - y + MOD) % MOD; }
long long mult(long long x, long long y) { return (x * y) % MOD; }
const int N = (int)1e6 + 7;
int cnt[N];
long long p2[N], a[N];
int main() {
  p2[0] = 1;
  for (int i = 1; i < N; i++) p2[i] = add(p2[i - 1], p2[i - 1]);
  int n;
  scanf("%d", &n);
  while (n--) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  for (int i = 1; i < N; i++) {
    int y = 0;
    for (int j = i; j < N; j += i) y += cnt[j];
    if (y == 0) continue;
    a[i] = mult(y, p2[y - 1]);
  }
  long long ans = 0;
  for (int x = N - 1; x > 1; x--) {
    for (int y = 2 * x; y < N; y += x) a[x] = sub(a[x], a[y]);
    ans = add(ans, mult(x, a[x]));
  }
  printf("%I64d\n", ans);
  return 0;
}
