#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
int add(int a, int b) { return a + b >= Mod ? a + b - Mod : a + b; }
int mul(int a, int b) { return 1ll * a * b % Mod; }
int dec(int a, int b) { return a - b < 0 ? a - b + Mod : a - b; }
void Add(int &a, int b) { a = add(a, b); }
void Mul(int &a, int b) { a = mul(a, b); }
void Dec(int &a, int b) { a = dec(a, b); }
int ksm(int a, int b) {
  int as = 1;
  for (; b; b >>= 1, Mul(a, a))
    if (b & 1) Mul(as, a);
  return as;
}
const int N = 5e5 + 50;
const int M = 1e7 + 50;
int mu[M];
bool isp[M];
vector<int> prm;
int n, m, b[M], pw[M];
void pw_init(int n) {
  pw[0] = 1;
  for (int i = 1; i <= n; i++) pw[i] = add(pw[i - 1], pw[i - 1]);
}
void linear_sieve(int n) {
  mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (!isp[i]) prm.push_back(i), mu[i] = -1;
    for (int c : prm)
      if (c * i > n)
        break;
      else {
        isp[c * i] = true;
        if (i % c == 0) break;
        mu[i * c] = -mu[i];
      }
  }
}
int work() {
  int as = 0;
  for (int i = 1; i <= m; i++)
    if (mu[i] && b[i] >= 1) {
      int c = b[i], coe = mul(dec(c, n), pw[c] - 1);
      (mu[i] == 1) ? Add(as, coe) : Dec(as, coe);
    }
  return as;
}
int main() {
  scanf("%d", &n);
  for (int i = 1, x; i <= n; i++) scanf("%d", &x), m = max(m, x), ++b[x];
  linear_sieve(m);
  for (int i = 1; i <= m; i++)
    for (int j = i + i; j <= m; j += i) b[i] += b[j];
  pw_init(m);
  cout << work();
  return 0;
}
