a, b, c, d = map(int, input().split()) limit = 32 - a + b if limit < d: print(3) elif limit < c: print(2) else: print(1)