#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int res = 0;
  for (auto c : s) {
    if (c == '1') {
      res++;
    } else {
      res *= 10;
    }
  }
  cout << res << endl;
  return 0;
}
