#include <bits/stdc++.h>
using namespace std;
int n, k = 0, dem = 0, s;
char c[1000001];
int e[100001];
deque<int> pq;
int main() {
  cin >> n;
  ;
  for (int i = 1; i <= n; ++i) {
    cin >> c[i];
    if (c[i] == '8') {
      pq.push_back(i);
      dem++;
    }
  }
  s = n - 11;
  s /= 2;
  for (int i = 1; i <= n; i++) {
    if (s == 0 || dem == 0) break;
    if (c[i] == '8') {
      pq.pop_front();
      dem--;
      s--;
    }
  }
  if (dem == 0 || pq.front() > n - 10)
    cout << "NO";
  else
    cout << "YES";
}
