#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T& x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}
template <typename T, typename... U>
inline void read(T& x, U&... y) {
  read(x), read(y...);
}
template <typename T>
inline bool checkMax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
template <typename T>
inline bool checkMin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
const int N = 1e6 + 10, mod = 1e9 + 7;
inline void add(int& x, int y) { x = (x + y) % mod; }
inline void mul(int& x, int y) { x = 1ll * x * y % mod; }
inline int qpow(int v, int p) {
  int res = 1;
  for (; p; p >>= 1, mul(v, v)) {
    if (p & 1) {
      mul(res, v);
    }
  }
  return res;
}
int n, a[N], m, v[N], f[N];
int main() {
  read(n);
  for (register int i = 1; i <= n; ++i) {
    read(a[i]), checkMax(m, a[i]), ++v[a[i]];
  }
  for (register int i = 2; i <= m; ++i) {
    for (register int j = i + i; j <= m; j += i) {
      add(v[i], v[j]);
    }
  }
  for (register int i = 2; i <= m; ++i) {
    f[i] = 1ll * v[i] * qpow(2, v[i] ? v[i] - 1 : 0) % mod;
  }
  int ans = 0;
  for (register int i = m; i > 1; --i) {
    for (register int j = i + i; j <= m; j += i) {
      add(f[i], mod - f[j]);
    }
    add(ans, 1ll * i * f[i] % mod);
  }
  printf("%d\n", ans);
  return 0;
}
