#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, j = 0, nb[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  string s;
  cin >> n;
  cin >> s;
  for (int i(0); i < n; i++) {
    if (s[i] == '1')
      nb[j]++;
    else
      j++;
  }
  for (int i(0); i <= j; i++) cout << nb[i];
  return 0;
}
