#include <bits/stdc++.h>
using namespace std;
char s[1111];
int main() {
  int n;
  scanf("%d", &n);
  scanf("%s", s);
  vector<int> vec;
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1')
      cnt++;
    else {
      vec.push_back(cnt);
      cnt = 0;
    }
  }
  vec.push_back(cnt);
  for (int i = 0; i < vec.size(); i++) printf("%d", vec[i]);
  printf("\n");
  return 0;
}
