eval"N,*A="+`dd`.split*?, i=0.0 p A.pop(N).permutation.count{|b|i+=1;A.zip(b).count{|x,y|x>y}*2>N}/i