#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string res, s;
  cin >> s;
  int curr = 0;
  char prev = '1';
  for (char c : s) {
    if (c == '1') {
      ++curr;
    } else {
      if (prev == '0') {
        res += '0';
      } else {
        res += to_string(curr);
      }
      curr = 0;
    }
    prev = c;
  }
  res += to_string(curr);
  cout << res;
}
