#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7, N = 300005;
int n, cnt[N][20], fac[N], inv[N], x, pre[N];
int ksm(int x, int y) {
  int ans = 1;
  for (; y; y >>= 1, x = (long long)x * x % M)
    if (y & 1) ans = (long long)ans * x % M;
  return ans;
}
int C(int x, int y) {
  if (x < y) return 0;
  return (long long)fac[x] * inv[y] % M * inv[x - y] % M;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    for (int j = 2; j * j <= x; j++)
      if (x % j == 0) {
        int v = 0;
        while (x % j == 0) x /= j, v++;
        cnt[j][v]++;
      }
    if (x != 1) cnt[x][1]++;
  }
  fac[0] = inv[0] = 1;
  int ans = 0;
  for (int i = 1; i <= n; i++)
    fac[i] = (long long)fac[i - 1] * i % M, inv[i] = ksm(fac[i], M - 2);
  pre[0] = C(n - 1, 0);
  for (int i = 1; i < n; i++) pre[i] = (pre[i - 1] + C(n - 1, i)) % M;
  for (int i = 1; i <= 300000; i++) {
    int tot = n;
    for (int j = 1; j < 19; j++) tot -= cnt[i][j];
    for (int j = 1; j < 19; j++) {
      int l = tot + 1, r = tot + cnt[i][j];
      for (int k = l; k <= r; k++)
        ans = (ans + ((long long)(k == 1 ? 0 : pre[k - 2]) - pre[n - 1] +
                      pre[k - 1] + M) *
                         j) %
              M;
      tot += cnt[i][j];
    }
  }
  printf("%d\n", ans);
}
