#include <bits/stdc++.h>
using namespace std;
int n;
int t[300000];
vector<int> plist[300000];
int st[300000];
long long pow2[600000];
long long powmod(long long a, long long n) {
  if (n == 0) return 1;
  if (n == 1) return a;
  if (n % 2) return (a * powmod(a, n - 1)) % 1000000007;
  long long c = powmod(a, n / 2);
  return (c * c) % 1000000007;
}
long long dp[300000];
long long ncr[400000];
long long ans = 0;
int main() {
  pow2[0] = 1;
  for (int i = 1; i < 600000; i++) {
    pow2[i] = (pow2[i - 1] * 2) % 1000000007;
  }
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &t[i]);
    for (int p = 2; p * p <= t[i]; p++) {
      int r = 0;
      while (t[i] % p == 0) {
        t[i] /= p;
        r++;
      }
      if (r > 0) plist[p].push_back(r);
    }
    if (t[i] > 1) plist[t[i]].push_back(1);
  }
  ncr[0] = 1;
  n--;
  for (long long i = 1; i <= n; i++) {
    ncr[i] = ncr[i - 1] * (n - i + 1);
    ncr[i] %= 1000000007;
    ncr[i] *= powmod(i, 1000000007 - 2);
    ncr[i] %= 1000000007;
  }
  dp[0] = (pow2[n] + 1000000007 - 1) % 1000000007;
  for (int i = 1; i <= n; i++) {
    dp[i] = dp[i - 1] - ncr[i] - ncr[i - 1] + 1000000007 + 1000000007;
    dp[i] %= 1000000007;
  }
  for (int i = 0; i < 300000; i++) {
    int k = plist[i].size();
    if (k == 0) continue;
    for (int j = 0; j < k; j++) {
      st[j] = -plist[i][j];
    }
    sort(st, st + k);
    for (int j = 0; j < k; j++) {
      st[j] = -st[j];
      long long c = st[j];
      ans += c * dp[j];
      ans %= 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
