#include <bits/stdc++.h>
using namespace std;
string st;
int frq, rs;
int n;
int main() {
  cin >> n;
  cin >> st;
  for (int i = 0; i < n; i++) {
    if (frq == -1 && st[i] != '8') break;
    if (st[i] != '8' && frq != -1)
      frq++;
    else if (st[i] == '8')
      rs++;
    if (frq == (n - 11) / 2) frq = -1;
  }
  if (rs * 2 > (n - 11)) {
    puts("YES");
    return 0;
  }
  puts("NO");
}
