io.stdin:read("*l") print((function (s, l, h) local t,m,r = {},0,0 for i=l,h do t[i] = 0 end s:gsub("%d", function (e) e=tonumber(e) t[e] = t[e] + 1 end) for i=l,h do if m <= t[i] then m,r = t[i],i end end return r end)(io.stdin:read("*l"), 1, 6))