#include <bits/stdc++.h>
int main() {
  int n, a, b = 0, c = 0, i;
  scanf("%d", &n);
  for (i = 0; i < n - 10; i++) {
    scanf("%1d", &a);
    if (a == 8)
      b++;
    else
      c++;
  }
  if (b > c)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
