#include <bits/stdc++.h>
using namespace std;
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
long long reset(long long n, long long pos) { return n = n & ~(1LL << pos); }
bool check(long long n, long long pos) { return (bool)(n & (1LL << pos)); }
long long mul(long long a, long long b) {
  long long c;
  c = (a % 1000000007 * b % 1000000007) % 1000000007;
  return c;
}
long long add(long long a, long long b) {
  long long c;
  c = (a % 1000000007 + b % 1000000007) % 1000000007;
  return c;
}
long long sub(long long a, long long b) {
  long long c;
  c = ((a % 1000000007 - b % 1000000007) % 1000000007 + 1000000007) %
      1000000007;
  return c;
}
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long s2, s1, t2, t1;
long long egcd(long long a, long long b) {
  long long temp;
  if (a % b == 0) {
    return s1;
  }
  temp = s2 - (a / b) * s1;
  s2 = s1;
  s1 = temp;
  temp = t2 - (a / b) * t1;
  t2 = t1;
  t1 = temp;
  return egcd(b, a % b);
}
long long arr[200005];
vector<long long> primes;
long long m;
long long val;
int main() {
  scanf("%lld", &m);
  for (long long i = 1; i <= m; i++) {
    scanf("%lld", &val);
    if (arr[val] == 0) {
      primes.push_back(val);
    }
    arr[val]++;
  }
  sort(primes.begin(), primes.end());
  long long d = 1;
  long long ans = 1;
  for (long long i = 0; i < primes.size(); i++) {
    long long fp =
        power(primes[i], (arr[primes[i]] + 1) * arr[primes[i]] / 2, 1000000007);
    ans = power(ans, (arr[primes[i]] + 1), 1000000007) *
          power(fp, d, 1000000007) % 1000000007;
    d = d * (arr[primes[i]] + 1) % (1000000007 - 1);
  }
  printf("%lld\n", ans);
  return 0;
}
