#include <bits/stdc++.h>
const int INF = 1 << 29;
std::string solve(std::string s, int n) {
  int cnt = 0;
  std::string ans = "";
  for (int i = 0; i < n; i++) {
    if (s[i] == '1')
      cnt++;
    else if (s[i] == '0') {
      if (cnt == 0)
        ans += '0';
      else {
        ans += std::to_string(cnt);
        cnt = 0;
      }
    }
  }
  ans += std::to_string(cnt);
  return ans;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(NULL);
  ;
  int n;
  std::string s;
  std::cin >> n >> s;
  std::cout << solve(s, n);
  return 0;
}
