#include <bits/stdc++.h>
using namespace std;
void getint(int &v) {
  char ch, fu = 0;
  for (ch = '*'; (ch < '0' || ch > '9') && ch != '-'; ch = getchar())
    ;
  if (ch == '-') fu = 1, ch = getchar();
  for (v = 0; ch >= '0' && ch <= '9'; ch = getchar()) v = v * 10 + ch - '0';
  if (fu) v = -v;
}
const int MO = 1e9 + 7;
long long fac[500010], ans, inv[500010], f[500010], s[500010];
int p[500010], pr, a[500010], t, S, ts, cnt, n, q[500010];
bool u[500010];
vector<int> v[100010];
long long pw(long long x, long long y) {
  long long t = 1;
  for (; y; y >>= 1) {
    if (y & 1) t = t * x % MO;
    x = x * x % MO;
  }
  return t;
}
long long C(int x, int y) { return fac[x] * inv[y] % MO * inv[x - y] % MO; }
void getp(int n) {
  for (int i = 2; i <= n; i++) {
    if (!u[i]) {
      p[++pr] = i;
      q[i] = pr;
    }
    for (int j = 1; j <= pr; j++) {
      if (i * p[j] > n) break;
      u[i * p[j]] = 1;
      q[i * p[j]] = j;
      if (i % p[j] == 0) break;
    }
  }
}
long long Q(int x, int y) {
  if (x > y) return 0ll;
  if (x == 0) return s[y];
  return s[y] - s[x - 1];
}
int main() {
  getp(300000);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    getint(t);
    while (t > 1) {
      int y = q[t], x = p[y], cnt = 0;
      while (t % x == 0) t /= x, ++cnt;
      v[y].push_back(cnt);
    }
  }
  fac[0] = 1;
  for (int i = 1; i <= 300000; i++) fac[i] = fac[i - 1] * i % MO;
  inv[300000] = pw(fac[300000], MO - 2);
  for (int i = 299999; i >= 0; i--) inv[i] = inv[i + 1] * (i + 1) % MO;
  for (int i = 0; i <= n - 1; i++) f[i] = C(n - 1, i);
  s[0] = f[0];
  for (int i = 1; i <= n - 1; i++) s[i] = (s[i - 1] + f[i]) % MO;
  for (int i = 1; i <= pr; i++)
    if (v[i].size()) {
      sort(v[i].begin(), v[i].end());
      ts = n - v[i].size();
      S = ts + 1;
      for (int j = 0; j < v[i].size(); ++j) a[++ts] = v[i][j];
      for (int k = S; k <= n; k++)
        (ans += a[k] * (Q(n - k + 1, n - 1) - Q(0, n - k - 1))) %= MO;
    }
  (ans += MO) %= MO;
  cout << ans << endl;
  return 0;
}
