#include <bits/stdc++.h>
using namespace std;
string s;
int n, tot = 0;
bool f = 1;
int sum = 0;
int main() {
  cin >> n;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      tot++;
      f = 1;
    }
    if (s[i] == '0' && !f) {
      cout << 0;
    }
    if (s[i] == '0' && f) {
      cout << tot;
      tot = 0;
      f = 0;
    }
  }
  if (tot)
    cout << tot;
  else if (s[n - 1] == '0')
    cout << 0;
  return 0;
}
