#include <bits/stdc++.h>
using namespace std;
const int maxn = 300010;
const long long mod = 1e9 + 7;
int p[maxn], pcnt, n;
bool vis[maxn];
vector<int> son[maxn], prime_s[maxn];
long long val[maxn], sum[maxn];
long long pp(long long a, long long b) {
  if (!b) return 1;
  long long cnt = pp(a, b / 2);
  cnt = cnt * cnt % mod;
  if (b & 1) cnt = cnt * a % mod;
  return cnt;
}
void init() {
  for (int i = 2; i < maxn; ++i) {
    if (!vis[i]) p[pcnt++] = i;
    for (int j = 0; j < pcnt && p[j] * i < maxn; ++j) {
      vis[p[j] * i] = 1;
      if (i % p[j] == 0) break;
    }
  }
  for (int i = 0; i < pcnt; ++i)
    for (int j = p[i]; j < maxn; j += p[i]) prime_s[j].push_back(i);
  sum[0] = 1;
  long long cur = 1;
  for (int i = 1; i < n; ++i) {
    cur = cur * (n - i) % mod * pp(i, mod - 2) % mod;
    sum[i] = (sum[i - 1] + cur) % mod;
  }
  for (int i = 0; i < n; ++i) val[i] = (sum[i] - sum[n - 1 - i]) % mod;
}
int main() {
  scanf("%d", &n);
  init();
  int x;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    for (int j = 0; j < prime_s[x].size(); ++j) {
      int tot = 0, cur = x, pos = prime_s[x][j];
      while (cur % p[pos] == 0) ++tot, cur /= p[pos];
      son[pos].push_back(tot);
    }
  }
  long long ans = 0;
  for (int i = 0; i < pcnt; ++i) {
    sort(son[i].begin(), son[i].end());
    int tot = n - son[i].size();
    for (int j = 0; j < son[i].size(); ++j)
      (ans += 1ll * son[i][j] * val[tot + j] % mod) %= mod;
  }
  ans = (ans % mod + mod) % mod;
  printf("%d\n", (int)ans);
  return 0;
}
