#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Cin(T& x) {
  char c;
  T sign = 1;
  x = 0;
  for (c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') sign = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sign;
}
template <typename T>
inline void Out(T x) {
  if (x > 9) Out(x / 10);
  putchar(x % 10 + '0');
}
template <typename T>
inline void Cout(T x, char c) {
  if (x < 0) putchar('-');
  x = abs(x);
  Out(x);
  putchar(c);
}
template <typename T, typename... Args>
inline void Cin(T& a, Args&... args) {
  Cin(a);
  Cin(args...);
}
template <typename T, typename... Args>
inline void Cout(T a, char c, Args... args) {
  Cout(a, c);
  Cout(args...);
}
const int N = 1e6 + 7;
const int M = 1e5 + 7;
const long double pi = 3.1415926535897;
int n, q, invalid[N];
string s;
vector<int> v, g;
void Enter() {
  cin >> n >> s;
  q = n - 11;
  for (int i = n - 1; i >= 0; --i) {
    if (s[i] == '8')
      v.push_back(i);
    else
      g.push_back(i);
  }
  while (q--) {
    if (v.empty()) {
      cout << "NO\n";
      exit(0);
    }
    if (q % 2 == 0) {
      while (g.size() && invalid[g.back()]) g.pop_back();
      if (g.size())
        invalid[g.back()] = 1, g.pop_back();
      else {
        while (v.size() && invalid[v.back()]) v.pop_back();
        if (v.size()) invalid[v.back()] = 1, v.pop_back();
      }
    } else {
      while (v.size() && invalid[v.back()]) v.pop_back();
      if (v.size())
        invalid[v.back()] = 1, v.pop_back();
      else
        invalid[g.back()] = 1, g.pop_back();
    }
  }
  for (int i = 0; i < n; ++i) {
    if (!invalid[i]) {
      if (s[i] == '8')
        cout << "YES\n";
      else
        cout << "NO\n";
      break;
    }
  }
}
void Solve() {}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Enter();
  Solve();
  return 0;
}
