#include template void __print(Ts &&...ts) {}; #ifdef DEBUG #include "print.hpp" #endif // DEBUG using namespace std; typedef long long ll; typedef long double ld; typedef complex cd; typedef pair pi; typedef pair pl; typedef pair pd; template using vec = vector; typedef vector vi; typedef vector vvi; typedef vector vd; typedef vector vvd; typedef vector vl; typedef vector vvl; typedef vector vpi; typedef vector vpl; typedef vector vcd; template using pq_max = priority_queue; template using pq_min = priority_queue, greater>; #define FOR(i, a, b) for (int i = a; i < (b); ++i) #define F0R(i, a) for (int i = 0; i < (a); ++i) #define FORd(i, a, b) for (int i = (b)-1; i >= a; --i) #define F0Rd(i, a) for (int i = (a)-1; i >= 0; --i) #define trav(a, x) for (auto &a : x) #define uid(a, b) uniform_int_distribution(a, b)(rng) #define pln(x) cout << x << "\n" #define ps(x) cout << x << " " #define entr cout << "\n" #define IN(n) \ int n; \ cin >> n; #define sz(x) (int)(x).size() #define mp make_pair #define pb push_back #define fir first #define sec second #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define ins insert #define beg begin template bool ckmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; } template bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template T max(T a, T b, T c) { return max(max(a, b), c); } template T max(T a, Ts... as) { return max(a, max(as...)); } template T min(T a, T b, T c) { return min(min(a, b), c); } template T min(T a, Ts... as) { return min(a, min(as...)); } /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// const int big = 1e9; void solution() { int n; cin >> n; vector coaches(n+1, -1); coaches[0] = 0; ll sum = 0; int last[10] = {0}; FOR(i,1,10) { last[i] = big; } FOR(i, 1, n+1) { int a; cin >> a; sum += a; if(last[sum%10] < big) { coaches[last[sum%10]] = i; } last[sum%10] = i; } FOR(i, 0, n) { if(coaches[i] >= 0 && coaches[i] != i) { cout << coaches[i] - i; } else { cout << -1; } cout << " "; } } int main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); int qs = 1; // cin >> qs; while (qs--) { solution(); } return 0; }