#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 7, p = 1e9 + 7;
int n, f[N], len[N], que[N], res[N];
vector<int> v[N], t[N], q[N];
long long ans, sum[N], inv[N], ret[N];
inline int read() {
  int num = 0;
  char g = getchar();
  while (g < 48 || 57 < g) g = getchar();
  while (47 < g && g < 58)
    num = (num << 1) + (num << 3) + g - 48, g = getchar();
  return num;
}
inline int pows(long long u, int v) {
  long long ans = 1;
  while (v > 0) {
    if (v & 1) ans = ans * u % p;
    u = u * u % p, v = v >> 1;
  }
  return ans;
}
inline long long getans(int a, int b) {
  return sum[a] * inv[b] % p * inv[a - b] % p;
}
int main() {
  n = read();
  int val;
  sum[0] = 1, inv[0] = 1;
  for (int i = 1; i <= 3e5; i++)
    sum[i] = sum[i - 1] * i % p, inv[i] = pows(sum[i], p - 2), f[i] = i;
  for (int i = 2; i <= 3e5; i++) {
    for (int x = i; x <= 3e5; x += i) {
      if (f[x] % i) continue;
      v[x].push_back(i), t[x].push_back(1);
      f[x] /= i;
      while (!(f[x] % i)) f[x] = f[x] / i, t[x][len[x]]++;
      len[x]++;
    }
  }
  for (int i = 1; i <= n; i++) {
    val = read();
    for (int x = 0; x < len[val]; x++)
      q[v[val][x]].push_back(t[val][x]), que[v[val][x]]++;
  }
  ret[0] = getans(n - 1, 0);
  for (int x = 1; x < n; x++) ret[x] = ret[x - 1] + getans(n - 1, x);
  for (int i = 1; i <= 3e5; i++) {
    if (!que[i]) continue;
    for (int x = 1; x <= que[i]; x++) res[x] = q[i][x - 1];
    sort(res + 1, res + que[i] + 1);
    for (int t = 1; t <= que[i]; t++) {
      int x = t + n - que[i];
      long long cnt = ret[n - 1] - getans(n - 1, n - x);
      if (n - x - 1 >= 0) cnt = cnt - 2 * ret[n - x - 1];
      ans = (ans + cnt * res[t]) % p;
    }
  }
  cout << (ans + p) % p << endl;
  return 0;
}
