#include <bits/stdc++.h>
using namespace std;
const double pi = 3.14159265358979323846;
void rw() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  string t;
  cin >> n >> t;
  map<long long, long long> s;
  vector<long long> r;
  long long a[n + 1], c = 0, pre = 0, suf = 0, flag = 0;
  for (int i = 0; i < n; i++) {
    a[i + 1] = t[i] - '0';
    s[a[i + 1]]++;
  }
  for (int i = 1; i <= n - 1; i++) {
    r.clear(), r.push_back(i);
    pre += a[i], suf = 0;
    for (int j = i + 1; j <= n; j++) {
      suf += a[j];
      if (suf > pre) r.push_back(j - 1), suf = a[j];
      if (suf == pre && j == n) r.push_back(n);
    }
    if (r.size() > 1 && r.back() == n) {
      c = 0;
      s.clear();
      for (int i = 1; i <= r[0]; i++) c += a[i];
      s[c]++;
      for (int i = 1; i < r.size(); i++) {
        c = 0;
        for (int j = r[i - 1] + 1; j <= r[i]; j++) c += a[j];
        s[c]++;
      }
      if (s.size() == 1) {
        cout << "YES";
        goto done;
      }
    }
  }
  cout << "NO";
done:;
  return 0;
}
