#include <bits/stdc++.h>
using namespace std;
int n;
char a[90];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int i, j, ret = 0, flag = 0, tmp = 0, en;
  cin >> n >> a;
  en = strlen(a) - 1;
  while (a[en] == '0') en--;
  en++;
  for (i = 0; i < strlen(a); i++) {
    if (a[i] == '1') {
      tmp++;
      flag = 1;
    } else if (flag == 0 && a[i] == '0')
      ret *= 10;
    else if (a[i] == '0' && flag == 1) {
      ret = ret * 10 + tmp;
      tmp = 0;
      flag = 0;
      if (i == en) {
        ret *= 10;
      }
    }
  }
  if (tmp) ret = ret * 10 + tmp;
  cout << ret << endl;
  return 0;
}
