#include <bits/stdc++.h>
const int oo = 2139063143;
const int N = 5e5 + 100;
const int P = 1000000007;
using namespace std;
inline void sc(int &x) {
  x = 0;
  static int p;
  p = 1;
  static char c;
  c = getchar();
  while (!isdigit(c)) {
    if (c == '-') p = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c - 48);
    c = getchar();
  }
  x *= p;
}
inline void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
inline void pr(int x) { print(x), putchar('\n'); }
const int M = 1e7 + 100;
int cnt[M], mi[N], f[M];
int main() {
  int n, ma = 0;
  sc(n);
  mi[0] = 1;
  for (int i = 1; i <= n; i++) {
    int sb;
    sc(sb);
    ++cnt[sb];
    ma = max(ma, sb);
    mi[i] = 2LL * mi[i - 1] % P;
  }
  int ans = 0;
  for (int i = ma; i >= 2; i--) {
    int sum = 0;
    for (int j = i; j <= ma; j += i) sum += cnt[j];
    if (!sum) continue;
    f[i] = 1LL * (mi[sum] - 1) * (n - sum) % P;
    for (int j = i + i; j <= ma; j += i) f[i] = (f[i] - f[j] + P) % P;
    (ans += f[i]) %= P;
  }
  pr(ans);
  return 0;
}
