#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 123;
int n, m, k, a[N], d;
int p[N];
string s;
map<int, int> cnt;
int main() {
  cin >> n >> s;
  for (int i = 1; i <= n; ++i) {
    a[i] = s[i - 1] - '0';
    p[i] = p[i - 1] + a[i];
  }
  for (int i = 2; i <= n; ++i) {
    if (p[n] % i) continue;
    vector<int> ans;
    ans.clear();
    bool flag = true;
    int now = 0, need = p[n] / i;
    for (int j = 1; j <= n; ++j) {
      now += a[j];
      if (now > need) {
        flag = false;
        break;
      }
      if (now == need) {
        ans.push_back(j);
        now = 0;
      }
    }
    if (ans.size() == i && flag) return cout << "YES", 0;
  }
  cout << "NO";
  return 0;
}
