#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(false);
  int nb_chars;
  std::string encoded_num;
  std::cin >> nb_chars;
  std::cin >> encoded_num;
  uint16_t sum = 0;
  for (std::string::iterator it = encoded_num.begin(); it != encoded_num.end();
       it++) {
    std::string tmp(&*it, 1);
    if (std::stoi(tmp) == 0) {
      std::cout << sum;
      sum = 0;
      continue;
    }
    sum += stoi(tmp);
  }
  std::cout << sum << '\n';
  return 0;
}
