#include<iostream>
#include<vector>
using namespace std;
const long long mod=1e9+7;
int m, maxn,p; long long fp,prdt=1,d=1;
vector<long long> cnt(2e5+1); // prime factors less than 2*10^5
long long modpow(long long a, long long x){
long long e=1;
while(x){
if(x&1) e=e*a%mod;
a=a*a%mod; x>>=1;
}
return e;
}
int main(){
cin>>m; for(int i=1; i<=m; ++i) cin>>p, ++cnt[p], maxn=max(maxn,p);
// Calculate product of divisors of a number from a given list of its prime factors
/* EXAMPLE:
(a^x * b^y * c^z * d^t)^(x+1)(y+1)(z+1)(t+1)
= a^(x(x+1)/2 * (y+1)(z+1)(t+1))
* b^(y(y+1)/2 * (x+1)(z+1)(t+1))
* c^(z(z+1)/2 * (x+1)(y+1)(t+1))
* d^(t(t+1)/2 * (x+1)(y+1)(z+1))
*/
for(int num=2; num<=maxn; ++num) if(cnt[num]){
// For a prime p raised to the pow a, f(p^a) = p^(a(a+1)/2)
fp = modpow(num, cnt[num]*(cnt[num]+1)/2) % mod;
// f(a*b) = f(a^d(b)) * f(b^d(a))
// where d(a), d(b) denotes the num of div in a & b
prdt = modpow(prdt, cnt[num]+1) * modpow(fp,d) % mod;
// The num of div d updated using Fermat’s Little Theorem:
// a^(m–1) = 1 (mod m), extended to a^x = a^(x % (m–1)) (mod m)
d = d * (cnt[num]+1) % (mod-1);
}
return cout<<prdt, 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHZlY3Rvcj4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNvbnN0IGxvbmcgbG9uZyBtb2Q9MWU5Kzc7CmludCBtLCBtYXhuLHA7IGxvbmcgbG9uZyBmcCxwcmR0PTEsZD0xOwp2ZWN0b3I8bG9uZyBsb25nPiBjbnQoMmU1KzEpOyAvLyBwcmltZSBmYWN0b3JzIGxlc3MgdGhhbiAyKjEwXjUKCmxvbmcgbG9uZyBtb2Rwb3cobG9uZyBsb25nIGEsIGxvbmcgbG9uZyB4KXsKCWxvbmcgbG9uZyBlPTE7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