#include <bits/stdc++.h>
using namespace std;
string st, ans;
int county, n, countz;
int main() {
  county = 0;
  ans = "";
  cin >> n;
  cin >> st;
  for (int i = 0; i <= n - 1; i++) {
    if (st[i] == '1') county++;
    if ((county != 0) && (st[i] == '0')) {
      ans += to_string(county);
      county = 0;
    } else if ((st[i] == '0') && (st[i - 1] == '0')) {
      ans += '0';
    }
    if ((i == n - 1) && (st[i] == '0')) ans += '0';
  }
  if (county != 0) ans += to_string(county);
  cout << ans << endl;
}
