import sys





def solve():

    readline = sys.stdin.buffer.readline

    mod = 10 ** 9 + 7

    m1, d1 = list(map(int, readline().split()))

    m2, d2 = list(map(int, readline().split()))

    print((1 if m1 != m2 and m1 < m2 else 0))





if __name__ == '__main__':

    solve()

import sys





def solve():

    input = sys.stdin.readline

    mod = 10 ** 9 + 7

    m, d = list(map(int, input().rstrip('\n').split()))

    m, d = list(map(int, input().rstrip('\n').split()))

    print((1 if d == 1 else 0))





if __name__ == '__main__':

    solve()

import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10**9 + 7
    m1, d1 = list(map(int, readline().split()))
    m2, d2 = list(map(int, readline().split()))
    print((1 if m1 != m2 and m1 < m2 else 0))


if __name__ == "__main__":
    solve()

import sys


def solve():
    input = sys.stdin.readline
    mod = 10**9 + 7
    m, d = list(map(int, input().rstrip("\n").split()))
    m, d = list(map(int, input().rstrip("\n").split()))
    print((1 if d == 1 else 0))


if __name__ == "__main__":
    solve()

-    readline = sys.stdin.buffer.readline +    input = sys.stdin.readline -    m1, d1 = list(map(int, readline().split())) -    m2, d2 = list(map(int, readline().split())) -    print((1 if m1 != m2 and m1 < m2 else 0)) +    m, d = list(map(int, input().rstrip("\n").split())) +    m, d = list(map(int, input().rstrip("\n").split())) +    print((1 if d == 1 else 0))