#include <bits/stdc++.h>
using namespace std;
using  ll = long long;
#define rep(i,n) for (int i = 0; i < (n); ++i)

int main(){
  string s;
  std::cin >> s;

  std::map<int,ll> ma;
  rep(i,s.size()){
    int num=(int)(s[i]-'0');
    ma[num]++;
  }

  if(s.size()==1){
    if(s[0]=='8')std::cout << "Yes" << '\n';
    else std::cout << "No" << '\n';
    return 0;
  }

  if(s.size()==2){
    int     si = std::stoi(s);
    int    s2i = ((int)(s[1]-'0'))*10+(int)(s[0]-'0');
    // std::cout << s2i << '\n';
    if(si%8==0 || s2i%8==0)std::cout << "Yes" << '\n';
    else std::cout << "No" << '\n';
    return 0;
  }

  for (int i = 1; i < 10; i++) {
    for (int k = 1; k < 10; k++) {
      for (int l = 1; l < 10; l++) {

        if((i*100+k*10+l)%8!=0)continue;

        std::map<int,ll> ma2=ma;
        if(ma2[i]>0)ma2[i]--;
        else continue;

        if(ma2[k]>0)ma2[k]--;
        else continue;

        if(ma2[l]>0){
          std::cout << "Yes" << '\n';
          return 0;
        }

      }
    }
  }

  std::cout << "No" << '\n';
  return 0;
}

#include <iostream>

using namespace std;

typedef long long ll;
ll num,b[200],sum=0;
int main()
{
    ll n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>num;
        b[num%200]++;
    }
    for(int i=0;i<200;i++)
    {
        if(b[i]>=2)
        {
            sum+=b[i]*(b[i]-1)/2;
        }
    }
    cout<<sum<<endl;
    return 0;
}