#include <bits/stdc++.h>
using namespace std;
long long int mod1 = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int t;
  t = 1;
  for (long long int f = 0; f < t; f++) {
    int n;
    cin >> n;
    string A;
    cin >> A;
    int i;
    int x = n - 11;
    int in = -1, c = 0;
    int y = 0;
    int r = ceil(x / 2.0);
    x = x / 2;
    for (i = 0; i < n; i++) {
      if (in == -1 && A[i] == '8') in = i + 1;
      if (A[i] == '8') c++;
      if (c == x + 1 && y == 0) y = i + 1;
    }
    if (in - 1 > r) {
      cout << "NO" << endl;
      continue;
    }
    if (c <= x) {
      cout << "NO" << endl;
      continue;
    } else {
      y = y - x;
      y--;
      if (y <= r) {
        cout << "YES" << endl;
        continue;
      }
      cout << "NO" << endl;
    }
  }
}
