#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  int n;
  cin >> n;
  char s[105];
  cin >> s;
  int sum = 0;
  int flag = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '1') sum++;
    if (s[i] == '0') flag = 1;
    if (flag == 1) {
      cout << sum;
      sum = 0;
      flag = 0;
    }
  }
  cout << sum << endl;
  return 0;
}
