sub f{my$a;$a|=$_-$_[1]&&f($_,@_)for@$_;$r+=!$a;!$a}/ /&&push@ $`,$'+!push@{$'+0},$`for<>;f$_=1;print$r