#include <bits/stdc++.h>
using namespace std;
const int N = 300100;
const int M = 50000;
const int mod = 1e9 + 7;
const int i2 = (mod + 1) / 2;
int pri[N], vis[N], len;
int a[N], fi[N], gi[N];
int ai[N];
vector<int> v[M];
int cal(int a, int b) {
  if (b > a) return 0;
  return 1ll * fi[a] * gi[b] % mod * gi[a - b] % mod;
}
int ppow(int a, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = 1ll * res * a % mod;
    k >>= 1;
    a = 1ll * a * a % mod;
  }
  return res;
}
int main() {
  fi[0] = fi[1] = 1;
  gi[0] = gi[1] = 1;
  for (int i = 2; i < N; i++) {
    fi[i] = 1ll * i * fi[i - 1] % mod;
    gi[i] = ppow(fi[i], mod - 2);
    if (!vis[i]) {
      vis[i] = len;
      pri[len++] = i;
    }
    for (int j = 0; j < len && i * pri[j] < N; j++) {
      if (i % pri[j] == 0) break;
      vis[i * pri[j]] = 1;
    }
  }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    for (int j = 0; pri[j] * pri[j] <= a[i]; j++) {
      int num = 0;
      while (a[i] % pri[j] == 0) {
        num++;
        a[i] /= pri[j];
      }
      if (num) v[j].push_back(num);
    }
    if (a[i] != 1) {
      v[vis[a[i]]].push_back(1);
    }
  }
  int res = 0;
  a[0] = 1 - ppow(2, n - 1);
  if (a[0] < 0) a[0] += mod;
  for (int i = 1; i < n; i++) {
    a[i] = (a[i - 1] + cal(n, i)) % mod;
  }
  for (int i = 0; i < len; i++) {
    int len = v[i].size();
    if (len == 0) continue;
    sort(v[i].begin(), v[i].end());
    for (int j = n - len; j < n; j++) {
      res = (res + 1ll * a[j] * v[i][j - n + len] % mod) % mod;
    }
  }
  printf("%d\n", res);
}
