#include <bits/stdc++.h>
int main() {
  int n;
  std::string s;
  std::cin >> n >> s;
  int cnt = 0;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1')
      cnt++;
    else {
      std::cout << cnt;
      cnt = 0;
    }
  }
  std::cout << cnt;
  return 0;
}
