#include #include #include using namespace std; unsigned long long fact(int n) { unsigned long long ret = 1; while (n > 1) ret *= n--; return ret; } int main(){ int n; cin >> n; vector array(n); for(int i=0;i> array[i]; } for(int i=n-1;i>=0;i--){ int max = 0; int index=0; int tmp=0; for(int j=i;j>=0;j--){ if(array[j]>max){ max=array[j]; index=j; } } tmp = array[i]; array[i] = max; array[index]=tmp; } int count = 1; unsigned long long ans = 1; int flag = 0; unsigned long long all=fact(n); while(flag