#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int main() {
int n;
if (scanf("%d", &n) != EOF) {
char* str = (char*)malloc(sizeof(char) * (n + 1));
scanf("%s", str);
str[n] = '\0';
int count1 = 0;
int firstIdx = -1;
for(int i = 0; i < n; i++) {
if(str[i] == '1') {
count1++;
if(firstIdx == -1) {
firstIdx = i;
}
}
}
if(count1 == 0 || count1 == 1) {
for(int i = 0; i < n; i++) {
printf("%d ", i + 1);
}
} else {
for(int i = 0; i < n; i++) {
if(str[i] == '0') {
printf("%d ", i + 1);
} else {
bool left = true;
for(int j = i + 1; j < n; j++) {
if(str[j] == '1') {
printf("%d ", j + 1);
left = false;
break;
}
}
if(left) {
printf("%d ", firstIdx + 1);
}
}
}
}
free(str);
} else {
printf("no input\n");
}
return 0;
}