#include <bits/stdc++.h>
using namespace std;
int n;
string s;
vector<int> cur;
int main() {
  cin >> n >> s;
  cur.push_back(-1);
  for (int i = 0; i < s.length(); ++i) {
    if (s[i] == '0') cur.push_back(i);
  }
  cur.push_back(s.length());
  for (int i = 0; i < cur.size() - 1; ++i) {
    cout << cur[i + 1] - cur[i] - 1;
  }
  cout << endl;
  return 0;
}
