# include int main() { int N,rez,i; scanf("%d",&N); rez = 1; for( i = 2 ; i < N ; ++i ) rez = ( (rez%N)*(i%N) ) %N; printf("%d",rez); return 0; }