#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string num;
  cin >> num;
  bool ward = true;
  int cont = 0;
  for (int i = 0; i < n; i++) {
    if (ward) {
      if (num[i] == '0') {
        cout << cont;
        cont = 0;
        ward = false;
      } else {
        cont++;
      }
    } else {
      if (num[i] == '0') {
        cout << 0;
      } else {
        cont++;
      }
      ward = true;
    }
  }
  cout << cont << endl;
}
