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