n = int(input()) C = list(map(int,input().split())) line = sum(C)/10 ret = 0 for c in C: if c<=line: ret += 30 print(ret)