#include <bits/stdc++.h>
const int N = 110000;
const int M = 10000000;
using namespace std;
int mu[M + 10], pw[M + 31], cnt[M + 10];
int ans;
int mult(int a, int b) { return 1ll * a * b % 1000000007; }
int add(int a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
int main() {
  ios_base::sync_with_stdio(0);
  pw[0] = 1;
  for (int i = 1; i <= M; i++) pw[i] = pw[i - 1] * 2 % 1000000007;
  mu[1] = 0;
  for (int i = 2; i <= M; i++) {
    if (mu[i] == 0) {
      for (int j = i; j <= M; j += i) mu[j]++;
    }
  }
  for (int i = 2; i <= M; i++) {
    if (mu[i] % 2 == 1) {
      mu[i] = 1;
    } else {
      mu[i] = -1;
    }
  }
  for (int i = 2; i * i <= M; i++) {
    for (int j = i * i; j <= M; j += i * i) {
      mu[j] = 0;
    }
  }
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int val;
    cin >> val;
    cnt[val]++;
  }
  for (int G = 2; G <= M; G++) {
    if (mu[G] == 0) continue;
    int s = 0;
    for (int i = G; i <= M; i += G) {
      s += cnt[i];
    }
    if (s == 0) continue;
    int rem = n - s;
    if (mu[G] == 1) {
      ans = add(ans, mult(rem, pw[s] - 1));
    } else {
      ans = add(ans, 1000000007 - mult(rem, pw[s] - 1));
    }
  }
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
