#include <bits/stdc++.h>
using namespace std;
long long f[300005], vf[300005];
long long pwmd(long long a, long long b) {
  long long r = 1;
  while (b) {
    if (b & 1) r = r * a % 1000000007ll;
    a = a * a % 1000000007ll;
    b /= 2;
  }
  return r;
}
long long c(int n, int k) {
  return f[n] * vf[k] % 1000000007ll * vf[n - k] % 1000000007ll;
}
int n;
int coef[300005], t[300005];
map<int, vector<int> > m;
int spf[300005];
void add(int x) {
  while (x != 1) {
    int p = spf[x];
    int c = 0;
    while (x % p == 0) {
      c++;
      x /= p;
    }
    m[p].push_back(c);
  }
}
long long res;
void go(vector<int> v) {
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = (0); i < (int(v.size())); i++)
    res += coef[n - i - 1] * 1ll * v[i];
  res %= 1000000007ll;
}
int main() {
  f[0] = 1;
  for (int i = (1); i < (300005); i++) f[i] = i * f[i - 1] % 1000000007ll;
  vf[300004] = pwmd(f[300004], 1000000007ll - 2);
  for (int i = 300003; i >= 0; i--) vf[i] = vf[i + 1] * (i + 1) % 1000000007ll;
  scanf("%d", &n);
  for (int i = (1); i < (n); i++) {
    t[i] = t[i - 1] + c(n - 1, i - 1);
    if (t[i] >= 1000000007ll) t[i] -= 1000000007ll;
  }
  for (int i = (0); i < (n); i++) {
    coef[i] = (1000000007ll + t[i] - t[n - i - 1]) % 1000000007ll;
  }
  for (int i = (2); i < (300005); i++)
    if (!spf[i]) {
      for (int j = i; j < 300005; j += i)
        if (!spf[j]) spf[j] = i;
    }
  for (int i = (0); i < (n); i++) {
    int x;
    scanf("%d", &x);
    add(x);
  }
  for (int i = (0); i < (300005); i++)
    if (m.count(i)) go(m[i]);
  printf("%lld\n", res);
}
