with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;

procedure Solve is
   M1 : Integer;
   D1 : Integer;
   M2 : Integer;
   D2 : Integer;
begin
   Get (M1);
   Get (D1);
   Get (M2);
   Get (D2);
   if M1 = M2 then
      Put_Line ("0");
   else
      Put_Line ("1");
   end if;
end Solve;