#include <bits/stdc++.h>
using namespace std;
int f[15];
string s;
int main() {
  int n;
  cin >> n;
  cin >> s;
  int c = 0, d = n + 1;
  long long sum = 0;
  for (int i = 0; i < n; i++) {
    if (s[i] == '8') {
      c++;
      if (c > (n - 11) / 2) {
        d = i;
        break;
      }
    }
  }
  cout << ((c > (n - 11) / 2 && (d - c + 1) <= (n - 11) / 2) ? "YES" : "NO")
       << endl;
  return 0;
}
