#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 10;
const long long mo = 1e9 + 7;
int n, num;
long long ans;
long long pri[MAXN], vis[MAXN], s[MAXN], inv[MAXN], fac[MAXN], invfac[MAXN];
vector<int> v[MAXN];
inline long long C(int a, int b) {
  if (a < b) return 0;
  return fac[a] * invfac[b] % mo * invfac[a - b] % mo;
}
template <class T>
inline void _read(T &x) {
  x = 0;
  char t = getchar();
  while (!isdigit(t) && t != '-') t = getchar();
  if (t == '-') {
    _read(x);
    x *= -1;
    return;
  }
  while (isdigit(t)) {
    x = x * 10 + t - '0';
    t = getchar();
  }
}
template <class T>
inline void print(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  _read(n);
  for (int i = 1, t; i <= n; ++i) {
    _read(t);
    for (int j = 2; j * j <= t; ++j) {
      if (t % j == 0) {
        if (!vis[j]) pri[++num] = j, vis[j] = num;
        int tmp = 0;
        while (t % j == 0) t /= j, ++tmp;
        v[vis[j]].push_back(tmp);
      }
    }
    if (t != 1) {
      if (!vis[t]) pri[++num] = t, vis[t] = num;
      v[vis[t]].push_back(1);
    }
  }
  inv[0] = inv[1] = fac[0] = fac[1] = invfac[0] = invfac[1] = 1;
  for (int i = 2; i <= n; ++i)
    inv[i] = mo - (mo / i) * inv[mo % i] % mo, fac[i] = fac[i - 1] * i % mo,
    invfac[i] = invfac[i - 1] * inv[i] % mo;
  s[0] = 1;
  for (int i = 1; i < n; ++i) s[i] = (s[i - 1] + C(n - 1, i)) % mo;
  for (int i = 1; i <= num; ++i) {
    int k = n - v[i].size();
    sort(v[i].begin(), v[i].end());
    for (auto it = v[i].begin(); it != v[i].end(); ++it)
      ++k, ans = (ans +
                  (*it) * (((k == 1) ? 0 : s[k - 2]) - s[n - 1] + s[k - 1])) %
                 mo;
  }
  print(ans);
  return 0;
}
