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