#include <bits/stdc++.h>
using namespace std;
int fun(string s, int i) {
  int k = 0;
  while (s[i] == '0' & i >= 0) {
    k++;
    i--;
  }
  return k;
}
int main(int argc, char const *argv[]) {
  string s;
  int a, k = 0, count = 1;
  cin >> a;
  cin >> s;
  string ans = "";
  int i = s.size() - 1;
  if (s[i] == '0') {
    while (s[i] == '0') {
      ans = ans + '0';
      i--;
    }
  }
  while (i >= 0) {
    k = 0;
    if (s[i] == '1') {
      while (s[i] == '1' && i >= 0) {
        k++;
        i--;
      }
      ans = ans + char('0' + k);
    } else if (s[i] == '0') {
      int t = fun(s, i);
      i = i - t;
      while (t > 1) {
        ans = ans + '0';
        t = t - 1;
      }
    }
  }
  reverse(ans.begin(), ans.end());
  int myint1 = stoi(ans);
  cout << myint1;
  return 0;
}
