n = int(input()) a = list(map(int,input().split())) a.sort() i = 0 s = 0 ans = [0] while True: if i == n-1: break else: s += a[i] if s % 10 == 0: ans.append(i) else: i += 1 print(max(ans))