#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, cont = 0, p, id = -1;
  cin >> n;
  string cad;
  cin >> cad;
  bool flag = 1;
  p = ((n - 11) / 2);
  for (int i = 0; i < cad.size(); i++) {
    if (cad[i] == '8') {
      cont++;
    }
    if (cont == p + 1 && id == -1) id = i;
  }
  if (id - p <= p && id != -1)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
