#include<bits/stdc++.h>
using namespace std;

using ui=unsigned int;
using ll=long long;
using ull=unsigned long long;
using i128=__int128_t;
using u128=__uint128_t;
using ld=long double;

void solve()
{
    int n;
	cin >> n;
	string s;
	cin >> s;
	if(s.back()=='0')
	{
		cout << -1;
		return;
	}
	else
	{
		vector<int>p(n,0),loc;
		for(int i=0;i<s.size();i++)
		{
			if(s[i]=='1') loc.push_back(i+1);
		}
		for(int i=0,j=0;i<n;)
		{
			while(s[i]!='1')
			{
				p[i]=loc[j];
				i++;
				loc[j]--;
			}
			p[i]=loc[j];
			i++;
			j++;
		}
		for(int i=0;i<n;i++) cout << p[i] << " ";
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	int t=1;
	//cin >> t;
	
	while(t--)
	{
		solve();
	}
	return 0;
}