#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string a;
  for (int i = 0; i < n; i++) {
    char temp;
    cin >> temp;
    a.push_back(temp);
  }
  int cn = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == '1') {
      cn++;
    } else {
      cout << cn;
      cn = 0;
    }
  }
  cout << cn;
  return 0;
}
