#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 1;
int a[maxn];
int n, m;
int answer[maxn];
void prepare () {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
}
void read () {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
}
void solve_all_zeros() {
for (int i = 0; i < n; i++) {
if (a[i] != 0) return;
}
for (int i = 1; i <= n; i++) {
printf("1");
}
printf("\n");
exit(0);
}
void remove_zeros() {
for (int i = 0; i < n; i++) {
if (a[i] == 0) continue;
a[m] = a[i];
m++;
}
}
vector<int> get_divisors(int S) {
vector<int> divisors;
for (int k = 1; k * k <= S; k++) {
if (S % k == 0) {
divisors.push_back(k);
if (S / k != k) {
divisors.push_back(S / k);
}
}
}
return divisors;
}
bool can_divide(int need_sum) {
vector<int> next(m), dp(m);
int current_sum = 0;
int left_iterator = 0;
int right_iterator = 0;
while (left_iterator < m) {
while (right_iterator < m && current_sum < need_sum) {
current_sum += a[right_iterator];
right_iterator++;
}
if (current_sum == need_sum) {
next[left_iterator] = right_iterator - 1;
} else {
next[left_iterator] = -1;
}
current_sum -= a[left_iterator];
left_iterator++;
}
for (int i = m - 1; i >= 0; i--) {
if (next[i] == -1) {
dp[i] = i;
} else {
if (next[i] + 1 < m) {
dp[i] = dp[next[i] + 1];
} else {
dp[i] = m;
}
}
}
current_sum = 0;
left_iterator = 0;
right_iterator = m - 1;
while (right_iterator >= 0 && current_sum < need_sum) {
current_sum += a[right_iterator];
right_iterator--;
}
while (left_iterator < m) {
current_sum += a[left_iterator];
left_iterator++;
while (right_iterator < m - 1 && current_sum > need_sum) {
right_iterator++;
current_sum -= a[right_iterator];
}
if (current_sum < need_sum) continue;
if (current_sum > need_sum) break;
if (dp[left_iterator] == right_iterator + 1) {
return true;
}
}
return false;
}
void solve () {
solve_all_zeros();
remove_zeros();
int sum = 0;
for (int i = 0; i < m; i++) {
sum += a[i];
}
vector<int> divisors = get_divisors(sum);
for (int divisor : divisors) {
if (sum / divisor > n) continue;
if (divisor == sum) {
answer[sum / divisor] = 1;
} else {
if (can_divide(divisor)) {
answer[sum / divisor] = 1;
}
}
}
for (int i = 1; i <= n; i++) {
printf("%d", answer[i]);
}
printf("\n");
}
int main () {
prepare();
read();
solve();
return 0;
}