#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
const int MOD = 1e9 + 7;
bool sv[N];
long long fac[N], inv[N], sum[N], two, ans = 0;
int n, a[N], b[N], p[26000], k = 0;
long long power(long long a, long long n) {
  return n == 0 ? 1 : power(a * a % MOD, n / 2) * (n & 1 ? a : 1) % MOD;
}
long long comb(int n, int k) {
  if (k < 0 || k > n)
    return 0;
  else
    return fac[n] * inv[k] % MOD * inv[n - k] % MOD;
}
int main() {
  fac[0] = inv[0] = sv[0] = sv[1] = 1;
  for (int i = 2; i < N; i++)
    if (!sv[i]) {
      for (int j = i << 1; j < N; j += i) sv[j] = 1;
      p[k++] = i;
    }
  for (int i = 1; i < N; i++)
    fac[i] = fac[i - 1] * i % MOD, inv[i] = power(fac[i], MOD - 2);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  for (int i = 0; i <= n; i++) sum[i] = (sum[i - 1] + comb(n, i)) % MOD;
  two = power(2, n - 1);
  for (int r = 0; p[r] * p[r] < N; r++) {
    for (int i = 0; i < n; i++) {
      int cnt = 0;
      while (a[i] % p[r] == 0) a[i] /= p[r], cnt++;
      b[i] = cnt;
    }
    sort(b, b + n);
    for (int i = 0; i < n; i++) ans += (sum[i] - two + MOD) * b[i], ans %= MOD;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) continue;
    int pos = i;
    while (a[i] == a[pos] && pos < n) {
      ans += sum[n - 1 - pos + i] - two + MOD, ans %= MOD, pos++;
    }
    i = pos - 1;
  }
  printf("%I64d\n", ans);
  return 0;
}
