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