#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int MAX = 200005;
int cnt[MAX], pre[MAX], suf[MAX];
int bpow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % MOD;
    b >>= 1;
    a = 1LL * a * a % MOD;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int val;
    cin >> val;
    cnt[val]++;
  }
  pre[0] = 1;
  for (int i = 1; i < MAX; i++)
    pre[i] = 1LL * pre[i - 1] * (cnt[i - 1] + 1) % (MOD - 1);
  suf[MAX - 1] = 1;
  for (int i = MAX - 2; i >= 0; i--)
    suf[i] = 1LL * suf[i + 1] * (cnt[i] + 1) % (MOD - 1);
  int ans = 1;
  for (int i = 0; i < MAX; i++)
    for (int j = 1; j <= cnt[i]; j++)
      ans = 1LL * ans *
            bpow(bpow(i, j), 1LL * pre[i] * suf[i + 1] % (MOD - 1)) % MOD;
  cout << ans << "\n";
  return 0;
}
