#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long n, cnt;
long long a[200010];
long long p[200010], rep[200010];
long long ans = 1;
inline long long quickpow(long long a, long long b, long long MOD) {
  long long s = 1;
  a %= MOD;
  b = b % (MOD - 1);
  while (b) {
    if (b & 1) s = (s * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return s;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    if (i == 1 || a[i] != a[i - 1]) {
      p[++cnt] = a[i];
      rep[cnt] = 1;
    } else
      rep[cnt]++;
  long long pro = 1;
  for (int i = 1; i <= cnt; i++)
    pro = (pro * (rep[i] + 1)) % (2 * 1000000007 - 2);
  for (int i = 1; i <= cnt; i++) {
    ans = ans *
          quickpow(p[i], pro * rep[i] / 2 % (2 * 1000000007 - 2), 1000000007) %
          1000000007;
  }
  printf("%lld\n", ans % 1000000007);
}
