#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, cnt = 0, t, B[100100];
  char A[100100]{};
  cin >> n;
  t = (n - 11) / 2;
  for (i = 0; i < n; i++) {
    scanf(" %c", &A[i]);
    if (A[i] == '8') B[cnt++] = i;
  }
  if (t < cnt && n - 11 - t >= B[t] - t)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
