#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string x;
  cin >> n >> x;
  int len = x.length();
  int a = 0;
  for (int i = 0; i < (len - 10); ++i) {
    if (x[i] == '8')
      ++a;
    else
      --a;
  }
  if (a >= 0)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
