#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k, p, total = 0;
  cin >> n;
  k = (n - 11) / 2;
  for (int i = 1; i <= n; i++) {
    char temp;
    cin >> temp;
    if (temp == '8') {
      total++;
      if (total == k + 1) p = i;
    }
  }
  if (total <= k)
    cout << "NO";
  else {
    p -= k;
    if ((p - 1) <= k)
      cout << "YES";
    else
      cout << "NO";
  }
}
