#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  long long n;
  cin >> n;
  string s;
  cin >> s;
  vector<long long> pref(n + 1);
  pref[0] = 0;
  char c;
  for (long long i = 1; i <= n; ++i) {
    c = (int)s[i - 1] - 48;
    pref[i] = pref[i - 1] + c;
  }
  long long q = n - 1;
  while (s[q] == '0') q--;
  q++;
  if (pref[n] == 0) {
    cout << "YES";
    return 0;
  }
  for (long long i = 1; i < pref[n]; ++i) {
    long long ind = 0;
    long long j = 1;
    while (ind < q) {
      while (j <= n && pref[j] - pref[ind] != i) j++;
      if (j == n + 1) break;
      ind = j;
      j++;
    }
    if (ind == q) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
}
