#include <bits/stdc++.h>
using namespace std;
char a;
int n, sum, flag = 1;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a != '0')
      sum++, flag = 1;
    else if (flag == 1 && a == '0') {
      cout << sum;
      sum = 0;
      flag = 0;
    } else if (a == '0' && flag == 0)
      cout << "0";
  }
  cout << sum;
}
