#include <bits/stdc++.h>
#pragma optimize("-O2")
using namespace std;
long long n, ans, cand;
char str[1111];
int main() {
  scanf("%lld", &n);
  scanf("%s", str);
  int len = strlen(str);
  str[len] = '0';
  len++;
  for (int i = 0; i < len; i++) {
    if (str[i] == '1')
      cand++;
    else
      ans = ans * 10LL + cand, cand = 0;
  }
  printf("%lld\n", ans);
}
