#include #include #include #include #include #include #include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; ll r = 1; for (int i = 0; i < n; i++) { int p; cin >> p; r = r * p % 9; } cout << r << endl; return 0; }