#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x, y = 0, z, p, q, r, s = 0, t;
  cin >> x;
  string a, b, c;
  cin >> a;
  p = (x - 11) / 2;
  for (int i = 0; i < x; i++) {
    if (a[i] == '8') {
      y++;
    }
  }
  for (int i = 0; i < (2 * p); i++) {
    if (a[i] == '8') {
      s++;
    }
  }
  for (int i = 0; i < x; i++) {
    if (a[i] == '8') {
      z = i + 1;
    }
  }
  q = (2 * p) - s;
  if (y > p && q < s) {
    cout << "YES" << endl;
  } else if (y > p && q == s && a[2 * p] == '8') {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
