#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int N = 100100;
char s[N];
int n;
int main() {
  scanf("%d %s", &n, s);
  int bal = 0;
  for (int i = 0; i < n - 10; i++) {
    if (s[i] == '8')
      bal++;
    else
      bal--;
  }
  if (bal > 0)
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
