#include <bits/stdc++.h>
using namespace std;
const int inf = 2e9;
const long long Inf = 1e10;
const int P = 1e9 + 7;
const int N = 500005;
inline int IN() {
  int x = 0;
  int ch = 0, f = 0;
  for (ch = getchar(); ch != -1 && (ch < 48 || ch > 57); ch = getchar())
    f = (ch == '-');
  for (; ch >= 48 && ch <= 57; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return f ? (-x) : x;
}
int Pow(int x, int y, int p) {
  int a = 1;
  for (; y; y >>= 1, x = (long long)x * x % p)
    if (y & 1) a = (long long)a * x % p;
  return a;
}
int n, a[N], f[N], C[N];
vector<int> ind[N];
int main() {
  scanf("%d", &n);
  for (int i = (int)(1); i <= (int)(n); i++) {
    int val = IN();
    for (int i = 2; i * i <= val; i++) {
      if (val % i) continue;
      int c = 0;
      for (; val % i == 0; val /= i, c++)
        ;
      ind[i].push_back(c);
    }
    if (val > 1) {
      ind[val].push_back(1);
    }
  }
  C[0] = 1;
  for (int i = (int)(1); i <= (int)(n - 1); i++)
    C[i] = (long long)C[i - 1] * (n - i) % P * Pow(i, P - 2, P) % P;
  f[1] = Pow(2, n - 1, P) - 1;
  if (f[1] < 0) f[1] += P;
  for (int i = (int)(2); i <= (int)(n); i++)
    f[i] = (0ll + f[i - 1] - C[i - 1] - C[i - 2] + P + P) % P;
  int ans = 0;
  for (int i = (int)(1); i <= (int)(300000); i++) {
    if (!ind[i].size()) continue;
    sort(ind[i].begin(), ind[i].end());
    for (int j = (int)(0); j < (int)(ind[i].size()); j++)
      ans = (ans + (long long)ind[i][ind[i].size() - 1 - j] * f[j + 1]) % P;
  }
  printf("%d\n", ans);
  return 0;
}
