print((function (fh)
	local h,n,s,t={},fh:read("*n"),0,0
	for i=1,n do h[i]=fh:read("*n") s=s+h[i] end s=s/10
	for i=1,n do if h[i]<=s then t=t+1 end end
	return 30*t
end)(io.stdin))