for$x(<>!~$"..2e3){map$a+=($x&$x+$_)==$`%1024,0..$'}print$`<$'?INF:$a