let arr1=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
let m1 = arr1[0]
let d1 = arr1[1]
let arr2=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}
print( (m1 != arr2[0]) ? 1 : 0 )