#include <bits/stdc++.h>   using namespace std;   const int mx = 2e5 + 10;   int main() {     int n, arr[mx], temp, z = 0;     queue<int> visit;     scanf( %d , &n);     for (int i = 0; i < n; i++) {       scanf( %d , &arr[i]);       if (arr[i] == 0) visit.push(i);     }     temp = visit.front();     visit.pop();     for (int i = 0; i < n; i++) {       if (arr[i] != 0) {         if (visit.size() > 0) {           if (abs(visit.front() - i) < abs(i - temp)) {             temp = visit.front();             visit.pop();           }         }         printf( %d , abs(i - temp));       } else {         if (i != n - 1) {           if (arr[i + 1] == 0) {             temp = visit.front();             visit.pop();           }         }         printf( 0 );       }       if (i != n - 1) printf(   );     }   }   