#include <bits/stdc++.h>
using namespace std;
long long t, n, c11, sum, m, mn, k, mx, avg;
map<long long, long long> mp;
int cum[100002];
bool isPrime(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
int main(void) {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int c = 0, c1 = 0;
  cin >> n;
  string s;
  string ans = "";
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    if (s[i] == '1') {
      c++;
      c1 = 0;
    } else {
      c1++;
      c1 = 0;
      cout << c;
      c = 0;
      if (c1 > 1) cout << 0;
    }
    if (i == s.length() - 1) {
      if (s[s.length() - 1] == '1')
        cout << c;
      else
        cout << 0;
    }
  }
}
