#include <bits/stdc++.h>
using namespace std;
string postprocess(string s) {
  int i = 0;
  while (s[i] == '0') {
    i++;
  }
  s.erase(0, i);
  return s;
}
int main() {
  int N, i, prev = -1;
  cin >> N;
  string s, ans;
  cin >> s;
  for (i = 0; i < N; i++) {
    if (s[i] == '0') {
      ans += to_string(i - prev - 1);
      prev = i;
    }
  }
  ans += to_string(i - prev - 1);
  cout << ans << endl;
  return 0;
}
