#include <bits/stdc++.h>
using namespace std;
void testCase() {
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long all = true;
  for (long long i = 1; i < n; i++) all &= (s[i] == s[i - 1]);
  if (all) {
    cout << "YES" << endl;
    return;
  }
  auto canDo = [&](long long x) {
    long long i = 0, j = n - 1;
    while (s[i] == '0') i++;
    while (s[j] == '0') j--;
    long long sum = 0;
    long long cuts = 0;
    long long lastCut = 0;
    for (; i <= j; i++) {
      sum += s[i] - '0';
      if (sum == x) sum = 0, cuts++, lastCut = i;
    }
    return cuts >= 2 and lastCut == j;
  };
  for (long long i = 1; i <= 1000; i++) {
    if (canDo(i)) {
      cout << "YES" << endl;
      return;
    }
  }
  cout << "NO" << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cin.tie(nullptr);
  long long t_c = 1;
  while (t_c--) testCase();
}
