#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const int Mod = 1e9 + 7;
const int N = 300000 + 5;
int n;
int a[N];
int ans;
vector<int> cnt[N];
int fac[N], ifac[N];
int pw[N];
inline int fpow(long long b, int e, int m) {
  b %= m;
  long long t = 1;
  for (; e; e >>= 1, (b *= b) %= m)
    if (e & 1) (t *= b) %= m;
  return (int)t;
}
inline void prepare() {
  fac[0] = 1;
  for (int _n(N - 1), i(0); i < _n; i++)
    fac[i + 1] = (long long)fac[i] * (i + 1) % Mod;
  ifac[N - 1] = fpow(fac[N - 1], Mod - 2, Mod);
  for (int i = N - 2; i >= 0; --i)
    ifac[i] = (long long)ifac[i + 1] * (i + 1) % Mod;
  pw[0] = 1;
  for (int _n(N - 1), i(0); i < _n; i++) pw[i + 1] = (pw[i] << 1) % Mod;
}
inline int C(int x, int y) {
  if (x < y) return 0;
  return (long long)fac[x] * ifac[y] % Mod * ifac[x - y] % Mod;
}
int main() {
  cout.sync_with_stdio(0);
  cin.tie(0);
  prepare();
  cin >> n;
  for (int _n(n), i(0); i < _n; i++) {
    cin >> a[i];
    int u = a[i];
    for (int j = 2; j * j <= u; ++j) {
      if (!(u % j)) {
        int k = 0;
        while (!(u % j)) {
          u /= j;
          ++k;
        }
        cnt[j].push_back(k);
      }
    }
    if (u > 1) cnt[u].push_back(1);
  }
  static int coe[N + 5];
  coe[0] = (pw[n - 1] - C(n, 0) + Mod) % Mod;
  for (int _n(n - 1), i(0); i < _n; i++)
    coe[i + 1] = (coe[i] - (long long)C(n, i + 1)) % Mod;
  ans = 0;
  for (int _n(N), i(2); i < _n; i++)
    if (!cnt[i].empty()) {
      sort((cnt[i]).begin(), (cnt[i]).end(), greater<int>());
      for (int _n(int(cnt[i].size())), j(0); j < _n; j++)
        (ans += (long long)cnt[i][j] * coe[j] % Mod) %= Mod;
    }
  (ans += Mod) %= Mod;
  printf("%d\n", ans);
  return 0;
}
