#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  string s;
  cin >> s;
  long long cnt = 0;
  string ans = "";
  for (long long i = 0; i < n; i++) {
    if (s[i] == '1') cnt++;
    if (s[i] == '0') {
      ans += '0' + cnt;
      cnt = 0;
    }
  }
  if (s[n - 1] == '0' && s[n - 2] == '0')
    ans += '0';
  else
    ans += '0' + cnt;
  cout << ans << "\n";
}
