#include <bits/stdc++.h>
int main() {
  int n, i, j = 0;
  scanf("%d\n", &n);
  int *s = (int *)malloc(n * sizeof(int));
  for (i = 0; i < n; i++) {
    s[i] = (int)getchar();
  }
  for (i = 0; i < n; i++) {
    if (s[i] == '1')
      j++;
    else {
      printf("%d", j);
      j = 0;
    }
  }
  printf("%d", j);
  return 0;
}
