#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int num[200000];
int N,a;
cin >> N;
for(int i=0;i<N;i++)
{
cin >> a;
num[i] = a%100000007;
}
sort(num,num+N);
int now = 0;
long long ans=1;
for(int i=0;i<N;i++)
{
ans = ans * (num[i]-now)%100000007;
now++;
}
cout<<ans;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbnVtWzIwMDAwMF07CglpbnQgTixhOwoJY2luID4+IE47Cglmb3IoaW50IGk9MDtpPE47aSsrKQoJewoJCWNpbiA+PiBhOwoJCW51bVtpXSA9IGElMTAwMDAwMDA3OwoJfQoJc29ydChudW0sbnVtK04pOwoJaW50IG5vdyA9IDA7Cglsb25nIGxvbmcgYW5zPTE7Cglmb3IoaW50IGk9MDtpPE47aSsrKQoJewoJCWFucyA9IGFucyAqIChudW1baV0tbm93KSUxMDAwMDAwMDc7CgkJbm93Kys7Cgl9Cgljb3V0PDxhbnM7Cn0=