#include <bits/stdc++.h>
using namespace std;
int n;
int cur;
vector<int> v;
string s;
bool dd;
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    char x = s[i];
    if (x == '0' && !dd)
      v.push_back(cur), cur = 0;
    else if (x == '1')
      cur++;
    else
      dd = 1;
    if (dd) v.push_back(0), dd = 0;
  }
  v.push_back(cur);
  for (int i = 0; i < v.size(); i++) cout << v[i];
  return 0;
}
