#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll b1[200010], a1[200010];
ll bigmod(ll x, ll y, ll mod){
ll i, j, res=1;
while(y>0){
if(y%2==1){
res=(res*x)%mod;
}
x=(x*x)%mod;
y=y/2;
}
return res;
}
int main(){
ll n, i, k, x, y, p, q, ii, jj, j, t, a[200010];
//scanf("%lld", &t);
//while(t--){
scanf("%lld", &n);
ll ans=1;
ll mod=1e9+7;
for(i=0; i<n; i++){
scanf("%lld", &a[i]);
ans=(ans*a[i])%mod;
a1[a[i]]++;
}
n=200000;
ii=0;
for(i=2; i<=n; i++){
if(a1[i]%2==1) ii=1;
}
if(ii==1){
//printf("88");
ll mod1=1e9+6;
for(i=2; i<=n; i++){
if(a1[i]%2==1){
jj=(a1[i]+1)/2;
a1[i]=0;
break;
}
}
//printf("%lld\n", jj);
for(i=2; i<=n; i++){
if(a1[i]>0) jj=(jj*(a1[i]+1))%mod1;
//printf("0000 %lld\n", jj);
}
//printf("%lld %lld\n", ans, jj);
ans=bigmod(ans, jj, mod);
printf("%lld\n", ans);
return 0;
}
ll mod1=1e9+6;
jj=1;
for(i=2; i<=n; i++){
if(a1[i]>0) jj=(jj*(a1[i]+1))%mod1;
}
//printf("66 %lld\n", jj);
for(i=2; i<=n; i++){
a1[i]=a1[i]/2;
}
ans=1;
for(i=2; i<=n; i++){
if(a1[i]>0){
x=bigmod(i, a1[i], mod);
ans=(ans*x)%mod;
}
}
//printf("77 %lld %lld\n", ans, jj);
ans=bigmod(ans, jj, mod);
printf("%lld\n", ans);
//}
return 0;
}
1667B - Optimal Partition | 1668B - Social Distance |
88B - Keyboard | 580B - Kefa and Company |
960A - Check the string | 1220A - Cards |
897A - Scarborough Fair | 1433B - Yet Another Bookshelf |
1283B - Candies Division | 1451B - Non-Substring Subsequence |
1408B - Arrays Sum | 1430A - Number of Apartments |
1475A - Odd Divisor | 1454B - Unique Bid Auction |
978C - Letters | 501B - Misha and Changing Handles |
1496A - Split it | 1666L - Labyrinth |
1294B - Collecting Packages | 1642B - Power Walking |
1424M - Ancient Language | 600C - Make Palindrome |
1669D - Colorful Stamp | 1669B - Triple |
1669A - Division | 1669H - Maximal AND |
1669E - 2-Letter Strings | 483A - Counterexample |
3C - Tic-tac-toe | 1669F - Eating Candies |