#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, n, t, mx = 0, cnt = 0, c = 0;
  string s;
  bool f = 0, flag = 0, m = 0;
  cin >> n;
  cin >> s;
  for (i = 0; i < n; i++) {
    if (s[i] == '0') {
      cout << cnt;
      cnt = f = 0;
    } else {
      cnt++;
      f = 1;
    }
  }
  cout << cnt;
  cout << endl;
  return 0;
}
