#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, len, cou1 = 0, cou0 = 0, i, pri = 0;
  char str[100];
  cin >> n;
  cin >> str;
  len = strlen(str);
  for (i = 0; i < len; i++) {
    if (str[i] == '1') {
      cou1++;
    } else {
      cout << cou1;
      cou1 = 0;
    }
  }
  cout << cou1;
  return 0;
}
