input() C = map(int,raw_input().split()) print sum(30 for c in C if sum(C)>=10*c)