#include <bits/stdc++.h>
using namespace std;
bool can(int* arr, int n, int sum) {
  int i = 0;
  while (i < n && arr[i] < sum) ++i;
  if (arr[i] > sum) return false;
  int j = 0;
  while (true) {
    j = i + 1;
    while (j < n && (arr[j] - arr[i]) < sum) ++j;
    if (j >= n || (arr[j] - arr[i]) > sum) return false;
    while (j < n - 1 && (arr[j] == arr[j + 1])) ++j;
    if (j == n - 1) return true;
    i = j;
  }
}
int main() {
  int n;
  cin >> n;
  char c;
  int* arr = new int[n];
  memset(arr, 0, sizeof(int) * n);
  cin.get();
  c = cin.get();
  arr[0] = c - '0';
  for (int i = 1; i < n; i++) {
    c = cin.get();
    arr[i] = arr[i - 1] + (c - '0');
  }
  bool happy = false;
  int k = 2, all_sum = arr[n - 1];
  if (all_sum == 0 || (all_sum == 1 && n == 1)) happy = true;
  while (k <= all_sum && !happy) {
    if (all_sum % k != 0) {
      ++k;
      continue;
    }
    happy = can(arr, n, all_sum / k);
    ++k;
  }
  if (happy)
    cout << "YES\n";
  else
    cout << "NO\n";
  delete[] arr;
  return 0;
}
