#include <bits/stdc++.h>
const int INF = 1e9;
const long long lINF = 1e18;
const double EPS = 1e-12;
using namespace std;
const int N = 5e5 + 100;
const int M = 1e7 + 100;
const int MOD = 1e9 + 7;
int n, a[N];
int cnt[M];
int powers2[N];
int mob[M];
int mx;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    mx = max(a[i], mx);
    cnt[a[i]]++;
  }
  mob[1] = 1;
  for (int i = 1; i <= mx; i++) {
    if (!mob[i]) {
      continue;
    }
    for (int j = 2 * i; j <= mx; j += i) {
      mob[j] -= mob[i];
      cnt[i] += cnt[j];
    }
  }
  powers2[0] = 1;
  for (int i = 1; i <= n; i++) {
    powers2[i] = powers2[i - 1] * 2;
    if (powers2[i] >= MOD) {
      powers2[i] -= MOD;
    }
  }
  int cntcoprime = 0;
  for (int i = 1; i <= mx; i++) {
    if (cnt[i]) {
      cntcoprime =
          (cntcoprime + 2 * cnt[i] * 1ll * powers2[cnt[i] - 1] * mob[i] -
           (powers2[cnt[i]] - 1) * 1ll * n * mob[i]) %
          MOD;
    }
  }
  if (cntcoprime < 0) {
    cntcoprime += MOD;
  }
  printf("%d\n", cntcoprime);
  return 0;
}
