#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fo(i, n) for(int i = 1; i <= n; ++i)
typedef long long ll;
const int N = 500500;
const int mod = 1e9 + 7;
int n, s, a[N];
vector<int> d;
int ans[N], dp[N];
inline int solve(int k) {
int one = s / k, curs = 0, res = 0;
dp[0] = 0;
int l = 0, sl = 0;
for(int i = 1; i <= n; ++i) {
curs += a[i];
while(sl + one < curs) sl += a[++l];
if(sl + one == curs) {
dp[i] = dp[l] + 1;
if(i < n && dp[i] + 1 == k) return 1;
} else dp[i] = 0;
}
return dp[n] == k;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n;
fo(i, n) cin >> a[i], s += a[i];
if(s == 0) {
fo(i, n) cout << 1;
return 0;
}
fo(i, n) a[i + n] = a[i];
for(int i = 1; i * i <= s; ++i)
if(s % i == 0) {
if(i <= n) d.pb(i);
if(i * i != s && s / i <= n) d.pb(s / i);
}
for(int k : d) {
ans[k] = solve(k);
}
fo(i, n) cout << ans[i];
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKI2RlZmluZSBwYiBwdXNoX2JhY2sKI2RlZmluZSBmbyhpLCBuKSBmb3IoaW50IGkgPSAxOyBpIDw9IG47ICsraSkKCnR5cGVkZWYgbG9uZyBsb25nIGxsOwoKY29uc3QgaW50IE4gPSA1MDA1MDA7CmNvbnN0IGludCBtb2QgPSAxZTkgKyA3OwoKaW50IG4sIHMsIGFbTl07CnZlY3RvcjxpbnQ+IGQ7CmludCBhbnNbTl0sIGRwW05dOwppbmxpbmUgaW50IHNvbHZlKGludCBrKSB7CiAgICBpbnQgb25lID0gcyAvIGssIGN1cnMgPSAwLCByZXMgPSAwOwogICAgZHBbMF0gPSAwOwogICAgaW50IGwgPSAwLCBzbCA9IDA7CiAgICBmb3IoaW50IGkgPSAxOyBpIDw9IG47ICsraSkgIHsKICAgICAgICBjdXJzICs9IGFbaV07CiAgICAgICAgd2hpbGUoc2wgKyBvbmUgPCBjdXJzKSBzbCArPSBhWysrbF07CiAgICAgICAgaWYoc2wgKyBvbmUgPT0gY3VycykgewogICAgICAgICAgICBkcFtpXSA9IGRwW2xdICsgMTsKICAgICAgICAgICAgaWYoaSA8IG4gJiYgZHBbaV0gKyAxID09IGspIHJldHVybiAxOwogICAgICAgIH0gZWxzZSBkcFtpXSA9IDA7CiAgICB9CiAgICByZXR1cm4gZHBbbl0gPT0gazsKfQoKaW50IG1haW4oKSB7CgogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oMCk7IGNpbi50aWUoMCk7CiAgICBjaW4gPj4gbjsKICAgIGZvKGksIG4pIGNpbiA+PiBhW2ldLCBzICs9IGFbaV07CiAgICBpZihzID09IDApIHsKICAgICAgICBmbyhpLCBuKSBjb3V0IDw8IDE7CiAgICAgICAgcmV0dXJuIDA7CiAgICB9CiAgICBmbyhpLCBuKSBhW2kgKyBuXSA9IGFbaV07CiAgICBmb3IoaW50IGkgPSAxOyBpICogaSA8PSBzOyArK2kpCiAgICAgICAgaWYocyAlIGkgPT0gMCkgewogICAgICAgICAgICBpZihpIDw9IG4pIGQucGIoaSk7CiAgICAgICAgICAgIGlmKGkgKiBpICE9IHMgJiYgcyAvIGkgPD0gbikgZC5wYihzIC8gaSk7CiAgICAgICAgfQogICAgZm9yKGludCBrIDogZCkgewogICAgICAgIGFuc1trXSA9IHNvbHZlKGspOwogICAgfQogICAgZm8oaSwgbikgY291dCA8PCBhbnNbaV07CiAgICByZXR1cm4gMDsKfQ==