N = int(input()) C = list(map(int,input().split())) b = sum(C) // 10 m = 0 for value in C: if value < b: m += 30 print(m)