#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
const int MOD = 1e9 + 7;
int n, pot2, inv[N], comb[N];
map<int, vector<int>> cnt;
void print(int n) {
  if (abs(n - MOD) < abs(n)) n -= MOD;
  cout << n << ' ';
}
int go(vector<int> &cnt) {
  sort(cnt.begin(), cnt.end());
  long long res = 0;
  int base = n - cnt.size();
  for (int i = 0; i < (int)cnt.size(); i++, base++) {
    res += (long long)cnt[i] * comb[base] % MOD;
  }
  res %= MOD;
  if (res < 0) res += MOD;
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  inv[1] = 1;
  for (int i = 2; i <= n; i++)
    inv[i] = (long long)(MOD - MOD / i) * inv[MOD % i] % MOD;
  comb[0] = 1;
  for (int i = 1; i <= n; i++)
    comb[i] = (long long)comb[i - 1] * (n + 1 - i) % MOD * inv[i] % MOD;
  for (int i = 1; i <= n; i++) {
    comb[i] += comb[i - 1];
    if (comb[i] >= MOD) comb[i] -= MOD;
  }
  pot2 = 1;
  for (int i = 0; i < n - 1; i++) {
    pot2 += pot2;
    if (pot2 >= MOD) pot2 -= MOD;
  }
  pot2 = (MOD - pot2) % MOD;
  for (int i = 0; i <= n; i++) {
    comb[i] += pot2;
    if (comb[i] >= MOD) comb[i] -= MOD;
  }
  for (int iter = 0; iter < n; iter++) {
    int x;
    cin >> x;
    for (int d = 2; d * d <= x; d++)
      if (x % d == 0) {
        int pot = 0;
        while (x % d == 0) {
          x /= d;
          pot++;
        }
        cnt[d].push_back(pot);
      }
    if (x > 1) cnt[x].push_back(1);
  }
  long long res = 0;
  for (auto &kv : cnt) {
    res += go(kv.second);
  }
  res %= MOD;
  cout << res << endl;
  return 0;
}
