#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long mod2 = 2000000012;
long long power(long long a, long long m) {
  long long ans = 1;
  while (m) {
    if (m & 1) ans = ans * a % mod;
    a = a * a % mod;
    m >>= 1;
  }
  return ans;
}
int main() {
  map<int, int> p;
  map<int, int>::iterator f;
  int m, q;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &q);
    f = p.find(q);
    if (f != p.end())
      (f->second)++;
    else
      p.insert(make_pair(q, 1));
  }
  long long all = 1;
  for (f = p.begin(); f != p.end(); f++) all = all * ((f->second) + 1) % mod2;
  long long ans = 1;
  for (f = p.begin(); f != p.end(); f++) {
    long long exp = (f->second) * all % mod2;
    exp /= 2;
    ans = ans * power((f->first), exp) % mod;
  }
  printf("%lld", ans);
}
