#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  string s, res;
  cin >> s;
  for (int i = 0; i < n; i++) {
    char c = '0';
    while (i < n && s[i] == '1') c++, i++;
    res += (c);
  }
  if (n > 1 && s[n - 1] == '0') res += '0';
  cout << res;
  return 0;
}
