#include using namespace std; using ll = long long; int main() { int n; cin >> n; ll res = 1; for (int i = 0; i < n; i++) { ll a; cin >> a; res *= a % 9 == 0 ? 9 : a % 9; } cout << (res % 9 == 0 ? 9 : res % 9) << endl; }