pairing up zero people requires one way .
ways [ 0 ] = 1LL ; ways [ 2 ] = 1LL ; for ( int i = 4 ; i <= MAX ; i += 2 ) { ways [ i ] = ( 1LL * ( i - 1 ) * ways [ i - 2 ] ) % mod ; } } void countWays ( int * arr , int n ) {