#include <bits/stdc++.h>
using namespace std;
bool vis[300005];
int prime[300005], cnt;
int prid[300005];
int coun[300005][20];
const int maxn = 300000;
const long long P = 1e9 + 7;
long long fac[300005], inv[300005], Cn[300005];
long long pow4(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % P;
    a = (a * a) % P;
    b >>= 1;
  }
  return res;
}
void init() {
  for (int i = 2; i <= maxn; ++i) {
    if (!vis[i]) {
      prime[cnt++] = i;
      prid[i] = cnt - 1;
    }
    for (int j = 0; i * prime[j] <= maxn && j < cnt; ++j) {
      vis[i * prime[j]] = true;
      if (i % prime[j] == 0) break;
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  init();
  for (int i = 1; i <= n; ++i) {
    int a;
    scanf("%d", &a);
    for (int j = 0; j < cnt; ++j) {
      int p = prime[j];
      if (p * p > a) break;
      if (a % p != 0) continue;
      int cntt = 0;
      while (a % p == 0) {
        a /= p;
        cntt++;
      }
      coun[j][cntt]++;
    }
    if (a > 1) coun[prid[a]][1]++;
  }
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fac[i] = fac[i - 1] * ((long long)i) % P;
  }
  inv[n] = pow4(fac[n], P - 2);
  for (int i = n - 1; i >= 0; i--)
    inv[i] = inv[i + 1] * ((long long)(i + 1)) % P;
  for (int i = 0; i <= n; ++i) Cn[i] = (fac[n] * inv[i] % P) * inv[n - i] % P;
  for (int i = 1; i <= n; ++i) Cn[i] = (Cn[i] + Cn[i - 1]) % P;
  for (int i = 1; i <= n; ++i) Cn[i] = (Cn[i] + Cn[i - 1]) % P;
  long long ans = 0;
  long long S = pow4(2, n - 1);
  for (int i = 0; i < cnt; ++i) {
    int tot = n;
    for (int j = 1; j < 20; ++j) tot -= coun[i][j];
    for (int j = 1; j < 20; ++j) {
      if (coun[i][j]) {
        int L = tot, R = L + coun[i][j] - 1;
        tot += coun[i][j];
        long long tem = Cn[R];
        if (L) tem = (tem - Cn[L - 1] + P) % P;
        tem = (tem - (S * ((long long)(coun[i][j]))) % P + P) % P;
        ans = (ans + (tem) * ((long long)j) % P) % P;
      }
    }
  }
  printf("%lld", ans);
  return 0;
}
