#include <bits/stdc++.h>
using namespace std;
int main() {
  string c;
  int l, t = 0;
  cin >> l;
  cin >> c;
  for (int i = 0; i < l; i++) {
    if (c[i] == '1') t++;
    if (c[i] == '0' || i == l - 1) {
      cout << t;
      t = 0;
    }
    if (c[i] == '0' && i == l - 1) {
      cout << 0;
      t = 0;
    }
  }
  return 0;
}
