N = int(input()) L = list(map(int,input().split())) ans = 0 for i in range(N): ans= (ans+L[i])%9 print(ans)