while 1:a=map(int,raw_input().split());print+all(x^y>(x^y)&~-(x^y)<1for x,y in zip(a,a[1:]))