#include <bits/stdc++.h>
using namespace std;
int n, ans;
char x;
int main() {
  scanf("%d", &n);
  getchar();
  for (int i = 1; i <= n; i++) {
    scanf("%c", &x);
    if (x == '1') ans++;
    if (x == '0') {
      printf("%d", ans);
      ans = 0;
    }
  }
  printf("%d", ans);
}
