#include using namespace std; #include using namespace __gnu_pbds; #define int long long typedef vector vi; typedef vector> vvi; typedef pair pii; typedef pair ppi; typedef vector vpi; typedef vector vppi; typedef queue qi; typedef queue qpi; typedef queue qppi; typedef tree, rb_tree_tag, tree_order_statistics_node_update> ost; #define f(i, a, b) for(int i = (a); i < (b); i++) #define bf(i, a, b) for(int i = (b) - 1; i >= (a); i--) #define all(x) x.begin(), x.end() #define pb emplace_back #define fi first #define se second #define swap(a,b) {__typeof(a) temp = a; a = b; b = temp;} #define gcd(a,b) __gcd(a,b) #define popcount(x) __builtin_popcount(x) #define dump(x) cerr << #x << " = " << x << "\n" #define ps(x) cout << x << " " #define pl(x) cout << x << "\n" #define pans(x) {if(x) pl("YES"); else pl("NO");} #define mod1 1000000007LL #define mod2 998244353LL #define mod3 10010101LL #define mod mod3 signed main() { ios_base::sync_with_stdio(0); cin.tie(0); int cou; cou = 1; //cin >> cou; f(coui, 0, cou) { int n; cin >> n; vi vals(10, -1); vi ans(n); vi inp(n); f(i,0,n) { cin >> inp[i]; } bf(i,0,n) { vi newval(10); int x = inp[i] % 10; f(j,0,10) { newval[j] = vals[(j - x + 10) % 10]; if (newval[j] != -1) newval[j] += 1; } newval[x] = 1; ans[i] = newval[0]; f(j,0,10) { vals[j] = newval[j]; //dump(vals[j]); }} f(i,0,n) { if (i < n-1) ps(ans[i]); else pl(ans[i]); } } return 0; }