#include using namespace std; #define ll long long #define debug(args...) \ cout << "#" << __LINE__ << ": "; \ __dbg(__split(#args, ',').begin(), args); vector __split(const string& s, char c) { vector v; stringstream ss(s); string x; while (getline(ss, x, c)) if (x!="") v.emplace_back(x); return move(v); } template inline string __to_str(T x) { stringstream ss; ss << "["; for (auto it = x.begin(); it != x.end(); it++) { if (it != x.begin()) ss << " "; ss << (*it); } ss << "]"; return ss.str(); } template inline string __to_str(stack x) { stringstream ss; ss << "["; bool first = 1; while (!x.empty()) { if (!first) ss << " "; ss << x.top(); x.pop(); first = 0; } ss << "]"; return ss.str(); } template ostream &operator<<(ostream &ostr, const pair p) { ostr << "(" << p.first << "," << p.second << ")"; return ostr; } template inline void __dbg_var(vector x) { cout << __to_str(x); } template inline void __dbg_var(list x) { cout << __to_str(x); } template inline void __dbg_var(set x) { cout << __to_str(x); } template inline void __dbg_var(unordered_set x) { cout << __to_str(x); } template inline void __dbg_var(stack x) { cout << __to_str(x); } template inline void __dbg_var(T val) { cout << val; } inline void __dbg(vector::iterator it) { cout << endl; } template inline void __dbg(vector::iterator it, T a, Args... args) { cout << it->substr((*it)[0] == ' ', it->length()) << "="; __dbg_var(a); cout << " "; __dbg(++it, args...); } const int MOD = 1e9+7; // x^n mod m ll _modpow(ll x, ll n, ll m = MOD) { if (n == 0) return 1 % m; ll u = _modpow(x,n/2,m); u = (u*u)%m; if (n & 1) u = (u*x)%m; return u; } auto speedup=[](){ std::ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return nullptr; }(); //----------------the actual program starts here---------------- int main() { int n; cin >> n; vector coaches(n); for (int i = 0; i < n; i++) cin >> coaches[i]; for (int i = 0; i < n; i++) { int s = coaches[i]; int ans = 1; for (int j = i+1; j < n; j++) { if (s % 10 == 0) break; else { s += coaches[j]; ans++; } } if (s % 10 != 0) cout << "-1"; else cout << ans; if (i < n-1) cout << " "; } return 0; }