#include using namespace std; int main() { int n, ans = 1; cin >> n; for (int i = 0; i < n; i++) { int64_t p; cin >> p; (ans *= p % 9) %= 9; } cout << ans << endl; }