#include <bits/stdc++.h>   using namespace std;   int visit[210000];   int ans[210000];   queue<int> q;   int a[210000];   int n;   vector<int> g[210000];   int main() {     int n;     cin >> n;     for (int i = 1; i <= n; i++) scanf( %d , &a[i]);     for (int i = 1; i <= n; i++) {       if (a[i] & 1) {         q.push(i);         visit[i] = 1;       }       if (i - a[i] >= 1) g[i - a[i]].push_back(i);       if (i + a[i] <= n) g[i + a[i]].push_back(i);     }     while (!q.empty()) {       int pos = q.front();       q.pop();       for (auto p : g[pos])         if (!visit[p]) {           q.push(p);           ans[p] = visit[p] = visit[pos] + 1;         }     }     memset((visit), (0), sizeof(visit));     for (int i = 1; i <= n; i++)       if (!(a[i] & 1)) {         q.push(i);         visit[i] = 1;       }     while (!q.empty()) {       int pos = q.front();       q.pop();       for (auto p : g[pos])         if (!visit[p]) {           q.push(p);           ans[p] = visit[p] = visit[pos] + 1;         }     }     for (int i = 1; i <= n; i++) cout << ans[i] - 1 <<    ;     return ~~(0 ^ 0 ^ 0);   }   