#include <bits/stdc++.h>
using namespace std;
const int MAXN = 300005;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
namespace ModCalculator {
const int MOD = 1e9 + 7;
inline void Inc(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
}
inline void Dec(int &x, int y) {
  x -= y;
  if (x < 0) x += MOD;
}
inline int Add(int x, int y) {
  Inc(x, y);
  return x;
}
inline int Sub(int x, int y) {
  Dec(x, y);
  return x;
}
inline int Mul(int x, int y) { return 1LL * x * y % MOD; }
inline int Ksm(int x, int k) {
  int ret = 1;
  for (; k; k >>= 1) {
    if (k & 1) ret = Mul(ret, x);
    x = Mul(x, x);
  }
  return ret;
}
inline int Inv(int x) { return Ksm(x, MOD - 2); }
}  // namespace ModCalculator
using namespace ModCalculator;
int n, fac[MAXN], finv[MAXN], sum[MAXN];
vector<int> a[MAXN];
inline int C(int x, int y) { return Mul(fac[x], Mul(finv[y], finv[x - y])); }
void init() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    int x;
    read(x);
    for (int j = 2; j * j <= x; ++j) {
      if (x % j) continue;
      int cnt = 0;
      while (x % j == 0) {
        ++cnt;
        x /= j;
      }
      a[j].push_back(cnt);
    }
    if (x > 1) {
      a[x].push_back(1);
    }
  }
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) {
    fac[i] = Mul(fac[i - 1], i);
  }
  finv[n] = Inv(fac[n]);
  for (int i = n; i >= 1; --i) {
    finv[i - 1] = Mul(finv[i], i);
  }
  sum[0] = 1;
  for (int i = 1; i < n; ++i) {
    sum[i] = Add(sum[i - 1], C(n - 1, i));
  }
}
void solve() {
  int ans = 0;
  for (int i = 2; i < MAXN; ++i) {
    if (!a[i].size()) continue;
    sort(a[i].begin(), a[i].end());
    int r = n - a[i].size();
    for (auto x : a[i]) {
      ++r;
      int coef = (r > 1 ? sum[r - 2] : 0);
      Dec(coef, Sub(sum[n - 1], sum[r - 1]));
      Inc(ans, Mul(x, coef));
    }
  }
  printf("%d\n", ans);
}
int main() {
  init();
  solve();
  return 0;
}
