#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, a[300005], c[300005], fact[300005], ifact[300005], ans;
vector<int> p[300005];
int power(int a, int k) {
  if (!k) return 1;
  int ans = power(a, k >> 1);
  ans = (long long)ans * ans % mod;
  if (k & 1) ans = (long long)ans * a % mod;
  return ans;
}
inline int calc(int num) {
  return ((long long)(c[n - 1] - c[n - num] - (num < n ? c[n - num - 1] : 0)) %
              mod +
          mod) %
         mod;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  fact[0] = ifact[0] = 1;
  for (int i = 1; i <= n; i++) {
    fact[i] = (long long)fact[i - 1] * i % mod;
    ifact[i] = (long long)ifact[i - 1] * power(i, mod - 2) % mod;
  }
  c[0] = 1;
  for (int i = 1; i < n; i++)
    c[i] = (c[i - 1] + (long long)fact[n - 1] * ifact[i] % mod *
                           (long long)ifact[n - i - 1] % mod) %
           mod;
  for (int i = 1; i <= n; i++) {
    for (int k = 2; k * k <= a[i]; k++)
      if (a[i] % k == 0) {
        int num = 0;
        while (a[i] % k == 0) {
          num++;
          a[i] /= k;
        }
        p[k].push_back(num);
      }
    if (a[i] > 1) p[a[i]].push_back(1);
  }
  for (int i = 2; i <= 300000; i++)
    if (!p[i].empty()) {
      sort(p[i].begin(), p[i].end());
      for (int j = 0, num = n - p[i].size() + 1; j < p[i].size(); j++, num++)
        ans = (ans + (long long)p[i][j] * calc(num) % mod) % mod;
    }
  printf("%d\n", ans);
  return 0;
}
