#include <bits/stdc++.h>
using namespace std;
const int S = 1e7 + 5, mod = 1e9 + 7;
int n, x, c[S], f[S], g[S], mx;
inline int quick_pow(int x, int p = mod - 2, int mul = 1) {
  for (; p; p >>= 1, x = 1LL * x * x % mod)
    if (p & 1) mul = 1LL * mul * x % mod;
  return mul;
}
inline int sub(const int& x, const int& y) {
  return x - y < 0 ? x - y + mod : x - y;
}
int main() {
  register int i, j;
  for (scanf("%d", &n), i = 1; i <= n; ++i)
    scanf("%d", &x), mx = max(mx, x), ++c[x];
  for (i = 1; i <= mx; ++i)
    for (j = i << 1; j <= mx; j += i) c[i] += c[j];
  for (i = 1; i <= mx; ++i)
    if (c[i]) f[i] = 1LL * c[i] * sub(quick_pow(2, c[i] - 1), 1) % mod;
  for (i = 1; i <= mx; ++i)
    if (c[i])
      g[i] = sub(1LL * n * sub(quick_pow(2, c[i]), 1) % mod,
                 1LL * c[i] * quick_pow(2, c[i] - 1) % mod);
  for (i = mx; i; --i)
    for (j = i << 1; j <= mx; j += i)
      f[i] = sub(f[i], f[j]), g[i] = sub(g[i], g[j]);
  return printf("%d", sub(f[1], g[1])), 0;
}
