#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, y, k = 0;
  bool t = false;
  string str;
  cin >> n;
  cin >> str;
  m = (n - 11) / 2;
  for (i = 0; i < n; i++) {
    if (str[i] == '8') {
      k++;
      if (k == m + 1) {
        t = true;
        y = i;
      }
    }
  }
  if (t)
    if (y - m <= m) {
      cout << "YES";
      return 0;
    }
  cout << "NO";
}
