#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s, s1;
  cin >> s1;
  s.push_back('0');
  s = s + s1;
  int ans = 0;
  bool isOne = 0;
  int tmp = 0;
  int switcher = 0;
  for (int i = s.length() - 1; i >= 0; --i) {
    if (s[i] - '0' == 1) {
      tmp++;
      isOne = 1;
    } else {
      if (isOne) {
        ans += tmp * pow(10, switcher);
        switcher++;
        isOne = 0;
        tmp = 0;
      } else {
        switcher++;
      }
    }
  }
  cout << ans << '\n';
}
