var
n,i,a,max: integer;
begin
readln(n);
max := -1;
for i := 1 to n do
readln(a);
if (a mod 10 = 3) and (a > max) then
max := a;
end;
writeln(max)
end.
// PascalABC.NET
var n := ReadInteger;
ReadSeqInteger(n).Count(p -> p mod 10 = 0).Print
var
n,i,a,max: integer;
begin
readln(n);
max := -1;
for i := 1 to n do
begin
readln(a);
if (a mod 10 = 3) and (a > max) then
max := a;
end;
writeln(max)
end.
// PascalABC.NET
begin
var n := ReadInteger;
ReadSeqInteger(n).Count(p -> p mod 10 = 0).Print
end.