#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); }
long long mod = 1e9 + 7;
vector<int> mu(1e7 + 1, -1), d(1e7 + 1), p, pall(1e7 + 1);
long long poww(long long a, long long k) {
  if (k == 0) return 1;
  if (!(k % 2)) {
    long long b = poww(a, k / 2);
    return ((b * b) + mod) % mod;
  }
  if (k % 2) {
    return (poww(a, k - 1) * a + mod) % mod;
  }
}
vector<int> ma;
vector<int> a;
void func(int n) {
  int m = n;
  vector<int> x;
  while (m > 1) {
    x.push_back(d[m]);
    m /= pall[m];
  }
  int perebor = (1 << x.size());
  for (int i = 0; i < perebor; i++) {
    int b = 1;
    for (int j = 0; j < x.size(); j++) {
      if (i & (1 << j)) b *= x[j];
    }
    ma[b]++;
  }
}
int n;
long long g(int k) {
  long long b = (-mu[k] * ((poww(2, ma[k]) - 1) * (n - ma[k]))) % mod;
  return (mod + b) % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int k = 1e7;
  ma.resize(k + 1);
  mu[1] = 1;
  for (int i = 2; i <= k; i++) {
    d[i] = i;
  }
  for (int i = 2; i <= k; i++) {
    if (d[i] == i) {
      p.push_back(i);
      pall[i] = i;
      mu[i] = -1;
    } else {
      int x = i / d[i];
      if (d[x] == d[i]) {
        mu[i] = 0;
        pall[i] = pall[x] * d[i];
      } else {
        mu[i] = -mu[x];
        pall[i] = d[i];
      }
    }
    for (long long j = 0; j < p.size() && p[j] <= d[i] && p[j] * i <= k; j++) {
      d[i * p[j]] = p[j];
    }
  }
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    func(a[i]);
  }
  int ans = 0;
  for (int i = 2; i <= k; i++) {
    ans += g(i);
    ans %= mod;
    ans = (mod + ans) % mod;
  }
  cout << ans;
}
