#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
string conv(long long int temp) {
  string a;
  stack<int> p;
  while (temp > 0) {
    p.push(temp % 10);
    temp = temp / 10;
  }
  while (p.size()) {
    char t = p.top() + '0';
    p.pop();
    a += t;
  }
  return a;
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ans;
  long long int cnt = 0;
  int zero = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '1') {
      cnt++;
      zero = 0;
    } else {
      if (zero) {
        ans += '0';
      } else {
        ans += conv(cnt);
        cnt = 0;
        zero = 1;
      }
    }
  }
  if (cnt) {
    ans += conv(cnt);
  } else
    ans += '0';
  cout << ans << endl;
  return 0;
}
