#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, i;
  cin >> n;
  string s, ans = "";
  cin >> s;
  i = 0;
  long long k = 0;
  while (i < n) {
    long long kol = 0;
    if (s[i] == 0) {
      k++;
      i++;
      continue;
    } else {
      for (long long j = 1; j < k; j++) {
        ans += '0';
      }
      k = 0;
      while (s[i] == '1') {
        kol++;
        i++;
      }
      ans += char(kol + 48);
      i++;
    }
  }
  if (s[n - 1] == '0')
    cout << ans << "0";
  else
    cout << ans;
  return 0;
}
