# 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 if P[i] % mod != 0 else 9 print(ans)