#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7, MAX = 2e5 + 5;
int fast_power(long long x, long long n, int mod) {
  long long ans = 1, base = x % mod;
  while (n) {
    if (n & 1) {
      ans = (ans * base) % mod;
      n--;
    } else {
      base = (base * base) % mod;
      n /= 2;
    }
  }
  if (ans < 0) ans += mod;
  return ans;
}
int mod_inv(int a, int mod) { return fast_power(a, mod - 2, mod); }
int main() {
  int m, x;
  scanf("%d", &m);
  int a[MAX] = {0};
  for (int i = 0; i < m; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  long long ans = 1;
  long long prodl[MAX] = {0}, prodr[MAX] = {0};
  prodl[0] = prodr[MAX - 1] = 1;
  for (int i = 1; i < MAX; i++) {
    prodl[i] = a[i] + 1;
    prodl[i] *= prodl[i - 1];
    prodl[i] %= mod - 1;
  }
  for (int i = MAX - 2; i >= 0; i--) {
    prodr[i] = a[i] + 1;
    prodr[i] *= prodr[i + 1];
    prodr[i] %= mod - 1;
  }
  for (int i = 2; i < MAX; i++) {
    if (a[i]) {
      long long b = (prodl[i - 1] * prodr[i + 1]) % (mod - 1);
      for (int j = 1; j <= a[i]; j++) {
        ans *= fast_power(i, (j * b) % (mod - 1), mod);
        ans %= mod;
      }
    }
  }
  printf("%lld\n", ans);
}
