#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, y = 0;
  cin >> n;
  string s;
  cin >> s;
  int a[n];
  int sum = 0;
  for (i = 0; i < n; i++) {
    if (s[i] == '0') y++;
    sum += (s[i] - '0');
    a[i] = sum;
  }
  if (y == n) {
    cout << "YES";
    return 0;
  }
  int f = 0;
  for (i = 0; i < n - 1; i++) {
    if (a[i] == 0) continue;
    if (a[n - 1] % a[i] != 0)
      continue;
    else {
      int t = 2, p = 1;
      for (j = i + 1; j < n; j++) {
        if (a[j] == t * a[i]) {
          p++;
          t++;
        }
      }
      if ((p + 1) * a[i] == a[n - 1] || (p * a[i] == a[n - 1] && p > 1)) {
        f = 1;
        break;
      }
    }
  }
  if (f == 1)
    cout << "YES";
  else
    cout << "NO";
}
