#include <bits/stdc++.h>
using namespace std;
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int main() {
  int n;
  cin >> n;
  string a;
  cin >> a;
  int c = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == '8') c++;
  }
  int turns = (n - 11);
  int m = turns / 2;
  if (m >= c) {
    cout << "NO";
    return 0;
  }
  int ind = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == '8') {
      m--;
      ind = i;
      if (m == -1) break;
    }
  }
  m = turns / 2;
  if (m >= ind - m) {
    cout << "YES";
    return 0;
  } else {
    cout << "NO";
    return 0;
  }
}
