#include <bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> pref;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int n;
  cin >> n;
  pref.resize(n + 1);
  string s;
  cin >> s;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    pref[i + 1] = pref[i] + (s[i] - '0');
  }
  int s1 = 0;
  for (int i = 0; i < n - 1; ++i) {
    s1 += (s[i] - '0');
    int st = i;
    while (st < n - 1) {
      int l, r;
      l = 1;
      r = n - st - 1;
      while (l != r) {
        int m = (l + r + 1) / 2;
        if (pref[st + m + 1] - pref[st + 1] > s1) {
          r = m - 1;
        } else {
          l = m;
        }
      }
      if (pref[st + l + 1] - pref[st + 1] == s1) {
        st += l;
      } else {
        break;
      }
    }
    if (st == n - 1) {
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  return 0;
}
