#include <bits/stdc++.h>
using namespace std;
template <typename T, typename S>
inline bool upmin(T& a, const S& b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T, typename S>
inline bool upmax(T& a, const S& b) {
  return a < b ? a = b, 1 : 0;
}
template <typename N, typename PN>
inline N flo(N a, PN b) {
  return a >= 0 ? a / b : -((-a - 1) / b) - 1;
}
template <typename N, typename PN>
inline N cei(N a, PN b) {
  return a > 0 ? (a - 1) / b + 1 : -(-a / b);
}
template <typename N>
N gcd(N a, N b) {
  return b ? gcd(b, a % b) : a;
}
inline void gn(long long& x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int& x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long& x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(double& x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline void gn(long double& x) {
  double t;
  scanf("%lf", &t);
  x = t;
}
inline long long sqr(long long a) { return a * a; }
inline double sqrf(double a) { return a * a; }
int inf = 0x3f3f3f3f;
double eps = 1e-6;
int mo = 1000000007;
int qp(int a, long long b) {
  int n = 1;
  do {
    if (b & 1) n = 1ll * n * a % mo;
    a = 1ll * a * a % mo;
  } while (b >>= 1);
  return n;
}
int fac[333333], ifac[333333];
int n;
int a[333333];
vector<int> nu[333333];
int xi[333333];
int c[333333];
void ini() {
  int n = ::n - 1;
  for (int i = (0), _ed = (n + 1); i < _ed; i++)
    c[i] = 1ll * fac[n] * ifac[i] % mo * ifac[n - i] % mo;
  for (int i = (1), _ed = (n + 2); i < _ed; i++)
    (((c[i]) = ((c[i]) + (c[i - 1])) % mo) < 0 ? (c[i]) += mo : (c[i]));
  for (int i = (0), _ed = (n + 1); i < _ed; i++) {
    xi[i + 1] = ((0ll + c[i] - (c[n] - (i ? c[i - 1] : 0))) % mo + mo) % mo;
  }
}
int gao(int p) {
  int ans = 0;
  int k0 = n - ((int)(nu[p]).size());
  for (int i = (0), _ed = (((int)(nu[p]).size())); i < _ed; i++) {
    int d = nu[p][i];
    (((ans) = ((ans) + (1ll * d * xi[k0 + 1 + i])) % mo) < 0 ? (ans) += mo
                                                             : (ans));
  }
  return ans;
}
int main() {
  fac[0] = 1;
  for (int i = (1), _ed = (300100); i < _ed; i++)
    fac[i] = 1ll * fac[i - 1] * i % mo;
  for (int i = (0), _ed = (300100); i < _ed; i++) ifac[i] = qp(fac[i], mo - 2);
  gn(n);
  ini();
  for (int i = (1), _ed = (n + 1); i < _ed; i++)
    ;
  for (int i = (1), _ed = (n + 1); i < _ed; i++) gn(a[i]);
  for (int i = (1), _ed = (n + 1); i < _ed; i++) {
    int x = a[i];
    for (int j = 2; j * j <= x; j++)
      if (x % j == 0) {
        int d = 0;
        while (x % j == 0) x /= j, d++;
        nu[j].push_back(d);
      }
    if (x > 1) nu[x].push_back(1);
  }
  for (int i = (1), _ed = (300000 + 1); i < _ed; i++)
    sort((nu[i]).begin(), (nu[i]).end());
  int ans = 0;
  for (int i = (1), _ed = (300000 + 1); i < _ed; i++)
    if (((int)(nu[i]).size()))
      (((ans) = ((ans) + (gao(i))) % mo) < 0 ? (ans) += mo : (ans));
  printf("%d\n", ans);
  return 0;
}
