#include <bits/stdc++.h>
using namespace std;
int main() {
  char c[100], c1[100];
  int n, a[100];
  cin >> n >> c;
  int num = 0, j = 0, zero = 0, k = 0, flag;
  for (int i = 0; i < n; i++) {
    if (c[i] == '1') {
      flag = 1;
      num++;
      if (zero > 1)
        for (int i = 1; i < zero; i++) cout << '0';
      zero = 0;
    } else if (c[i] == '0') {
      flag = 0;
      zero++;
      if (num > 0) cout << num;
      num = 0;
    }
  }
  if (flag == 1)
    cout << num;
  else if (flag == 0) {
    for (int i = 0; i < zero; i++) cout << '0';
  }
  cout << endl;
}
