#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m = 0, count = 0;
  string a, b;
  cin >> n;
  cin.ignore();
  getline(cin, a);
  for (i = 0; i < n; i++) {
    if (a[i] == '1') {
      count++;
    } else if (a[i] == '0' && a[i + 1] == '1' && a[i - 1] == '0') {
      continue;
    } else if (a[i] == '0' && a[i + 1] == '1') {
      b = b + (char)(count + 48);
      count = 0;
    } else if (a[i] == '0' && a[i - 1] == '1') {
      b = b + (char)(count + 48);
      b = b + (char)48;
      count = 0;
    } else if (a[i] == '0') {
      b = b + (char)48;
      count = 0;
    }
  }
  if (count > 0) b = b + (char)(count + 48);
  cout << b;
}
