# coding: utf-8 N = int(input()) P = list(map(int, input().split())) mod = 9 ans = 1 for i in range(N): ans *= P[i] % mod print(ans)