#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, nr8 = 0, poz = -1;
  string s;
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.size(); ++i)
    if (s[i] == '8') {
      nr8++;
      if (nr8 == (n - 11) / 2 + 1) poz = i + 1;
    }
  if (poz == -1)
    cout << "NO";
  else if (poz - (n - 11) / 2 <= (n - 11) / 2 + 1)
    cout << "YES";
  else
    cout << "NO";
}
