#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> pos;
  for (int j = 0; j < n; j++) {
    if (s[j] == '8') {
      pos.push_back(j);
    }
  }
  int to_be_del = n - 11;
  int moves_vas = to_be_del / 2;
  int moves_pet = to_be_del / 2;
  if (pos.size() <= moves_pet) {
    cout << "NO"
         << "\n";
  } else {
    int no_bef_eight = pos[moves_pet];
    no_bef_eight -= moves_pet;
    if (no_bef_eight <= moves_vas) {
      cout << "YES";
    } else {
      cout << "NO";
    }
  }
}
