#include <bits/stdc++.h>
using namespace std;
long long modpow(long long base, long long exp, long long modulus) {
  base %= modulus;
  long long result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % modulus;
    base = (base * base) % modulus;
    exp >>= 1;
  }
  return result;
}
int main() {
  string s;
  int n;
  cin >> n;
  cin >> s;
  s = s + '0';
  int count = 0;
  vector<int> ans;
  for (int i = 0; i <= n; i++) {
    if (s[i] == '0') {
      ans.push_back(count);
      count = 0;
      i++;
    }
    int cc = 0;
    while (i < 1 + n && s[i] == '0') {
      cc++;
      i++;
    }
    for (long long j = 0; j < cc; j++) {
      ans.push_back(0);
    }
    if (i < n + 1 && s[i] == '1') {
      count++;
    }
  }
  for (auto i : ans) {
    cout << i;
  }
  cout << endl;
  return 0;
}
