N = int(input()) from bisect import bisect C = list(map(int, input().split())) C.sort() print(bisect(C, sum(C) // 10 + 1) * 30)