#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> arr(90, -1);
  int sum = 0;
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (str[i] == '1') {
      sum += 1;
    } else if (str[i] == '0') {
      arr[count] = sum;
      sum = 0;
      count++;
    }
  }
  arr[count] = sum;
  for (int i = 0; i <= count; i++) {
    if (arr[i] == -1) {
      break;
    }
    cout << arr[i];
  }
}
