#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 9;
int n;
string s;
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> s;
  int d = 0;
  int res = 0;
  bool zero = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') {
      zero = 0;
      d++;
    } else if (s[i] == '0' && !zero) {
      res = res * 10 + d;
      zero = 1;
      d = 0;
    } else
      res = res * 10;
  }
  res = res * 10 + d;
  cout << res << endl;
  return 0;
}
