#include <bits/stdc++.h>
using namespace std;
const long long MAX_M = 200000ll;
long long m, primePowers[MAX_M + 5];
vector<long long> primes;
long long power(long long b, long long p) {
  long long ret = 1;
  long long powe = b;
  while (p > 0) {
    if (p & 1) ret *= powe, ret %= 1000000007ll;
    powe *= powe, powe %= 1000000007ll, p >>= 1;
  }
  return ret;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long modInverse(long long a, long long m) {
  long long x, y;
  gcdExtended(a, m, &x, &y);
  return (x % m + m) % m;
}
int main(int argc, const char *argv[]) {
  scanf("%lld", &m);
  for (long long(i) = (1); i <= (long long)(m); (i)++) {
    long long p;
    scanf("%lld", &p);
    if (!primePowers[p]) primes.push_back(p);
    ++primePowers[p];
  }
  long long numOfDiv = 1;
  bool div = false;
  for (long long p : primes) {
    if (!div && primePowers[p] & 1)
      numOfDiv *= (primePowers[p] + 1) >> 1, numOfDiv %= (1000000007ll - 1),
          div = true;
    else
      numOfDiv *= (primePowers[p] + 1), numOfDiv %= (1000000007ll - 1);
  }
  long long ans = 1;
  for (long long p : primes) {
    long long pow = numOfDiv;
    if (!div)
      pow *= (primePowers[p] / 2) % (1000000007ll - 1);
    else
      pow *= primePowers[p] % (1000000007ll - 1);
    ans *= power(p, pow), ans %= 1000000007ll;
  }
  printf("%lld\n", ans);
  return 0;
}
