#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, p = 0, q = 0;
  cin >> n;
  string s;
  cin >> s;
  n -= 11;
  int x = count(s.begin(), s.end(), '8');
  if ((n / 2) > x) {
    cout << "NO";
    return 0;
  } else {
    for (int i = 0; i < (n + 11); i++) {
      if (s[i] != '8' && p < n / 2) {
        s.erase(i, 1);
        i--;
        p++;
      } else if (s[i] == '8' && q < n / 2) {
        s.erase(i, 1);
        i--;
        q++;
      }
      if (p + q == n) break;
    }
  }
  if (s[0] == '8')
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
