#include <bits/stdc++.h>
using namespace std;
string e;
int ans, t;
int main() {
  cin >> t;
  cin >> e;
  for (int i = 0; i < e.size(); i++) {
    if (e[i] == '1')
      ans++;
    else {
      cout << ans;
      ans = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
