uses crt;
var f:text; s:string; a,b,c,d:longint;
function sn(a,b:longint):longint;
begin
if a<=7 then if a mod 2=0 then sn:=30 else sn:=31 else
if a mod 2=0 then sn:=31 else sn:=30;
if a=2 then if b mod 4=0 then sn:=29 else sn:=28;
end;
begin
clrscr;
assign(f,'input.pas');reset(f);
readln(f,s);
close(f);
assign(f,'output.pas');rewrite(f);
val(copy(s,1,2),a);
val(copy(s,4,2),b);
val(copy(s,7,4),c);
repeat
inc(a);
if sn(b,c)=a-1 then begin a:=1; inc(b); end;
if b=13 then begin inc(c); b:=1; end;
inc(d);
until (a=22)and(b=11)and(c=2022);
writeln(f,d-1);
close(f);
end.