sub i{sort{$a-$b}glob<>}@b=i;@d=!i;map{$d[$_+!($'<$b[$_]|$_>2)]+=$d[$_]for 3,2,//,0}i;print$d[3]