#include <bits/stdc++.h>
using namespace std;
const int NMAX = 333333;
const long long MOD = 1e9 + 7;
int n;
long long S[NMAX];
long long mpow(long long x, long long y) {
  if (y == 0) return 1;
  if (y % 2) return mpow(x, y - 1) * x % MOD;
  long long h = mpow(x, y / 2);
  return h * h % MOD;
}
long long minv(long long x) { return mpow(x, MOD - 2); }
void pre_process() {
  S[1] = 0;
  long long det = 1;
  for (long long i = 2; i <= n; i++) {
    S[i] = (S[i - 1] + det) % MOD;
    long long r = n - i + 1;
    det = det * r % MOD;
    det = det * minv(n - r) % MOD;
  }
}
long long process(vector<long long>& P) {
  sort(P.begin(), P.end());
  long long offset = n - P.size();
  long long ret = 0;
  for (int i = 0; i < P.size(); i++) {
    long long pos = i + offset + 1;
    long long co = (S[pos] - S[n + 1 - pos] + MOD) % MOD;
    ret = (ret + (co * P[i] % MOD)) % MOD;
  }
  return ret;
}
bool is_prime[NMAX];
vector<int> primes;
int prime2idx[NMAX];
void get_primes() {
  for (long long i = 2; i <= 300000; i++) is_prime[i] = true;
  for (long long i = 2; i <= 300000; i++) {
    if (is_prime[i]) {
      primes.push_back(i);
      for (long long j = i * i; j <= 300000; j += i) is_prime[j] = false;
    }
  }
  for (int i = 0; i < primes.size(); i++) {
    prime2idx[primes[i]] = i;
  }
}
vector<long long> factors[30000];
void fact(long long target) {
  for (long long i = 2; i * i <= target; i++) {
    if (target % i == 0) {
      int cnt = 0;
      while (target % i == 0) {
        target /= i;
        cnt++;
      }
      factors[prime2idx[i]].push_back(cnt);
    }
  }
  if (target > 1) factors[prime2idx[target]].push_back(1);
  return;
  for (int i = 0; i < primes.size(); i++) {
    long long p = primes[i];
    if (target % p == 0) {
      int cnt = 0;
      while (target % p == 0) {
        target /= p;
        cnt++;
      }
      factors[i].push_back(cnt);
    }
    if (target == 1) return;
  }
}
int main() {
  get_primes();
  cin.sync_with_stdio(0), cout.sync_with_stdio(0);
  cin >> n;
  pre_process();
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    fact(t);
  }
  long long ret = 0;
  for (int i = 0; i < primes.size(); i++) {
    ret += process(factors[i]);
    ret %= MOD;
  }
  cout << ret;
}
