import sequtils,bitops template `max=`*(x,y) = x = max(x,y) proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} var S = newSeq[int]() while true: let k = getchar_unlocked() if k < '0': break S &= k.ord - '0'.ord # var dp = newSeqWith(1 shl S.len,0) proc bitDP(s:int) : int = if s.popcount() + 3 > S.len : return 0 var ans = 0 for a in (not s).countTrailingZeroBits()..