N = int(input()) P = list(map(int, input().split())) print((sum(P) - 1) % 9 + 1)