#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MAX_N = 2e5 + 10;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string getStr() {
  char ch[1000001];
  scanf("%s", ch);
  return ch;
}
vector<long long> a;
long long cnt[MAX_N];
long long f = 1;
long long pref[MAX_N], suf[MAX_N];
long long pw[MAX_N];
long long res = 1;
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) {
    long long res = power(a, b / 2);
    return 1LL * res * res % MOD;
  }
  b /= 2;
  long long res = power(a, b);
  return ((1LL * res * res % MOD) * a) % MOD;
}
int32_t main() {
  pw[0] = 1;
  for (long long i = 1; i < MAX_N; i++) pw[i] = 1LL * pw[i - 1] * 2 % MOD;
  pref[0] = 1;
  long long n = in();
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    a[i] = in();
    cnt[a[i]]++;
  }
  sort(a.begin(), a.end());
  for (long long i = 1; i < MAX_N; i++)
    pref[i] = 1LL * pref[i - 1] * (cnt[i] + 1) % (MOD - 1);
  suf[MAX_N - 1] = 1;
  for (long long i = MAX_N - 2; i >= 0; i--)
    suf[i] = 1LL * suf[i + 1] * (cnt[i] + 1) % (MOD - 1);
  for (long long i = 1; i < MAX_N - 1; i++) {
    long long g = 1;
    for (long long x = 0; x < cnt[i]; x++) {
      g = 1LL * g * i % MOD;
      res = 1LL * res * power(g, 1LL * pref[i - 1] * suf[i + 1] % (MOD - 1)) %
            MOD;
    }
  }
  cout << res << endl;
}
