#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265359;
const double EPS = 1e-6;
const int INF = (2e9);
const long long P = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  long long val = 0;
  long long curr_dig = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '0') {
      val *= 10;
      val += curr_dig;
      curr_dig = 0;
    } else {
      curr_dig++;
    }
  }
  val *= 10;
  val += curr_dig;
  cout << val << endl;
  return 0;
}
