#include <bits/stdc++.h>
using namespace std;
void afify() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
const double EPS = 1e-4;
const long long oo = (long long)10e9 + 7;
const long long N = 1e4 + 5;
int main() {
  afify();
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt = 0;
  for (int i = (0); i < n; i++) {
    if (s[i] == '1') {
      cnt++;
    } else {
      cout << cnt;
      cnt = 0;
    }
  }
  cout << cnt << endl;
  return 0;
}
