#include <bits/stdc++.h>
using namespace std;
int n, m, ans, a[500005], p[10000005], mu[10000005], s[10000005], pw[500005];
bool vs[10000005];
int calc(int x) { return x ? 1ll * x * pw[x - 1] % 1000000007 : 0; }
void sieve(int n) {
  vs[1] = mu[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!vs[i]) p[++p[0]] = i, mu[i] = -1;
    for (int j = 1; i * p[j] <= n; ++j) {
      vs[i * p[j]] = 1;
      if (!(i % p[j])) break;
      mu[i * p[j]] = -mu[i];
    }
  }
}
int main() {
  scanf("%d", &n);
  pw[0] = 1;
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    ++s[a[i]];
    m = max(m, a[i]);
    pw[i] = pw[i - 1] * 2 % 1000000007;
  }
  sieve(m);
  for (int i = 1; i <= p[0]; ++i)
    for (int j = m / p[i]; j; --j) s[j] += s[j * p[i]];
  for (int i = 1; i <= m; ++i) {
    ans = (ans + 1ll * mu[i] * (calc(s[i]) - s[i])) % 1000000007;
    ans = (ans -
           1ll * mu[i] * (1ll * n * (pw[s[i]] - 1) % 1000000007 - calc(s[i]))) %
          1000000007;
  }
  printf("%d\n", (ans + 1000000007) % 1000000007);
  return 0;
}
