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