#include <bits/stdc++.h>
using namespace std;
int n, m;
long long a[200010];
long long pre[200010];
long long til[200010];
const int mod = 1e9 + 7;
long long pow_mod(long long x, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1LL) res = (res * x) % mod;
    x = (x * x) % mod;
    b >>= 1LL;
  }
  return res;
}
int main() {
  cin >> m;
  for (int i = 1; i <= m; i++) {
    long long tmp;
    scanf("%lld", &tmp);
    a[tmp]++;
  }
  long long res = 1;
  long long tmp = 1;
  pre[1] = 1;
  for (int i = 2; i <= 200000; i++)
    pre[i] = (pre[i - 1] * (a[i] + 1)) % (mod - 1);
  til[200001] = 1;
  for (int i = 200000; i >= 2; i--)
    til[i] = (til[i + 1] * (a[i] + 1)) % (mod - 1);
  for (int i = 2; i <= 200000; i++) {
    if (a[i] == 0) continue;
    long long tt = pre[i - 1] * til[i + 1] % (mod - 1);
    for (int k = 1; k <= a[i]; k++)
      res = (res * pow_mod(pow_mod(i, k), tt)) % mod;
  }
  cout << res << endl;
  return 0;
}
