def mrange(mask):
x = 0
while x != mask:
x = (x - mask) & mask
yield x
def f( i ) :
global s
if s[i] :
return s[i]
for x in mrange(i & (i - 1)) :
fk = fork( f(x), f(i-x) )
s[i] = merge( s[i], fk )
return s[i]
ZGVmIG1yYW5nZShtYXNrKToKICAgIHggPSAwCiAgICB3aGlsZSB4ICE9IG1hc2s6CiAgICAgICAgeCA9ICh4IC0gbWFzaykgJiBtYXNrCiAgICAgICAgeWllbGQgeAoKZGVmIGYoIGkgKSA6CiAgICBnbG9iYWwgcwogICAgaWYgc1tpXSA6CiAgICAgICAgcmV0dXJuIHNbaV0KICAgIGZvciB4IGluIG1yYW5nZShpICYgKGkgLSAxKSkgOgogICAgICAgIGZrID0gZm9yayggZih4KSwgZihpLXgpICkKICAgICAgICBzW2ldID0gbWVyZ2UoIHNbaV0sIGZrICkKICAgIHJldHVybiBzW2ldCg==