#include <bits/stdc++.h>
using namespace std;
const int _S = 10000010;
const int S0 = 10000000;
const int MOD = 1000000007;
int Pri[_S / 10], Pow[_S], n, numP;
int to[_S], num[_S], mul[_S];
void Init() {
  Pow[0] = 1, Pow[1] = 2;
  for (int i = 2; i <= S0; i++) {
    Pow[i] = 1LL * Pow[i - 1] * 2 % MOD;
    if (!to[i]) Pri[++numP] = i, to[i] = i;
    for (int j = 1; j <= numP && Pri[j] * i <= S0; j++) {
      to[Pri[j] * i] = Pri[j];
      if (i % Pri[j] == 0) break;
    }
  }
}
void Calc() {
  static int s, top, Stack[_S];
  scanf("%d", &n), mul[1] = -1;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &s);
    ++num[1];
    Stack[top = 1] = 1;
    while (s > 1) {
      static int now, old;
      now = to[s], old = top;
      while (s % now == 0) s /= now;
      for (int j = 1; j <= old; j++) {
        Stack[++top] = Stack[j] * now;
        mul[Stack[j] * now] = -mul[Stack[j]];
        ++num[Stack[j] * now];
      }
    }
  }
}
void Print() {
  static long long ans;
  for (int i = 2; i <= S0; i++)
    ans += 1LL * mul[i] * (Pow[num[i]] - 1) * (n - num[i]) % MOD;
  ans = (ans % MOD + MOD) % MOD;
  printf("%d\n", (int)ans);
}
int main() {
  Init();
  Calc();
  Print();
  return 0;
}
