#include <bits/stdc++.h>
using namespace std;
inline long long int power(long long int a, long long int b, long long int c) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a) % c;
    }
    a = (a * a) % c;
    b = b >> 1;
  }
  return ans;
}
long long int v[200001];
int main() {
  memset(v, 0, sizeof(0));
  long long int m, t;
  cin >> m;
  for (long long int i = 0; i < m; ++i) {
    cin >> t;
    v[t]++;
  }
  long long int n = 1;
  long long int ans = 1;
  for (long long int i = 1; i <= 200000; ++i) {
    if (v[i] != 0) {
      t = power(i, (v[i] * (v[i] + 1)) / 2, 1000000007);
      ans = (power(ans, v[i] + 1, 1000000007) * power(t, n, 1000000007)) %
            1000000007;
      n = (n * (v[i] + 1)) % (1000000007 - 1);
    }
  }
  cout << ans << endl;
  return 0;
}
