#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d = 0;
  cin >> n;
  char c;
  string s;
  for (int i = 0; i < n; ++i) {
    cin >> c;
    if (c == '0') {
      s += '0' + d;
      d = 0;
    } else {
      d++;
    }
  }
  if (c == '0') {
    s += '0';
  } else {
    s += '0' + d;
  }
  cout << s << endl;
}
