#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n;
int a[500005];
int dat[10000005];
long long gdat[10000005];
vector<int> p[500005];
vector<int> q;
vector<int> xq;
long long two[500005];
long long u[500];
long long dab;
void calc(int x) {
  int i;
  if (x == 1) return;
  for (i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      q.push_back(i);
      while (x % i == 0) x /= i;
      calc(x);
      return;
    }
  }
  q.push_back(x);
}
void calcdat(int now, int rnow, int op = 0) {
  if (now == q.size()) {
    if (!op) dat[rnow]++;
    xq.push_back(rnow);
    return;
  }
  calcdat(now + 1, rnow, op);
  calcdat(now + 1, rnow * q[now], op);
}
inline void mod(long long &x) {
  if (x >= 1000000007)
    x -= 1000000007;
  else if (x < 0)
    x += 1000000007;
}
int main() {
  int i, j, k;
  cin >> n;
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  two[0] = 1;
  for (i = 1; i < n + 2; i++) two[i] = two[i - 1] * 2, two[i] %= 1000000007;
  gdat[1] = 1;
  for (i = 0; i < n; i++) {
    int m;
    q.clear();
    xq.clear();
    calc(a[i]);
    p[i] = q;
    m = p[i].size();
    calcdat(0, 1);
    for (j = 0; j < (1 << m); j++) u[j] = two[dat[xq[j]] - 1];
    for (j = 0; j < m; j++) {
      for (k = 0; k < (1 << m); k++) {
        if (!(k & (1 << j))) u[k] -= u[k | (1 << j)], mod(u[k]);
      }
    }
    for (j = 0; j < (1 << m); j++) gdat[xq[j]] += u[j], mod(gdat[xq[j]]);
  }
  for (i = 0; i < n; i++) {
    int m = p[i].size();
    q = p[i];
    xq.clear();
    calcdat(0, 1, 1);
    for (j = 0; j < (1 << m); j++) u[j] = two[dat[xq[j]] - 1];
    for (j = 0; j < m; j++) {
      for (k = 0; k < (1 << m); k++) {
        if (!(k & (1 << j))) u[k] -= u[k | (1 << j)], mod(u[k]);
      }
    }
    dab += u[0] * 2 - gdat[1] + 1;
    dab %= 1000000007;
    mod(dab);
  }
  cout << dab;
  return 0;
}
