#include #define MAX_N 1000000 int arr[MAX_N]; typedef long long ll; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &arr[i]); for (int i = 0; i < n; ++i) { int k = 1; ll s = arr[i]; for (int j = i + 1; j < n && s % 10 != 0; ++j) { s += arr[j]; k++; } if (s % 10 == 0) { printf("%d", k); } else { printf("-1"); } if (i < n - 1) { putchar(' '); } else { putchar('\n'); } } }