#include<bits/stdc++.h>
//#include <atcoder/all>

#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define fi first
#define se second
#define sz(x) ((int)x.size())
 
using namespace std;
//using namespace atcoder;
using ld = long double;
using ll = long long;
using P = pair<ll, ll>;
 
template<typename T> bool chmin(T& a, const T& b) { if(a >= b){ a = b; return 1;} return 0; }
template<typename T> bool chmax(T& a, const T& b) { if(a <= b){ a = b; return 1;} return 0; }

const ll ZER = 0;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1e18;



int main(){
    ll od = 0, ev = 0;
    int n, k;
    cin >> n >> k;
    rep(i, n){
        int cnt = 0;
        string s;
        cin >> s;
        rep(j, sz(s)){
            if(s[j] == '1')cnt++;
        }
        // cout << cnt << endl;
        if(cnt % 2 == 1)od++;
        else ev++;
    }
    cout << ev * od << endl;
}

#include<bits/stdc++.h>
 
 
#define  all(v)            v.begin(), v.end()
#define  sz(x)             (int)x.size()
#define  debug(x)          cout << #x << ':' << x << endl;
#define  rep(i,n)          for(long long i = 0; i <  n ; i++)
#define  reps(i,n)         for(long long i = 1; i <= n ; i++)
#define  make_unique(v)    sort(all(v));v.erase(unique(all(v)), v.end());
#define  REMOVE(v,a)       v.erase(remove(v.begin(),v.end(), a), v.end());
#define  pb                push_back
#define  mp                make_pair
#define  endl              '\n'
#define  fi                first
#define  se                second
 
 
using namespace std;
typedef long long          ll;
typedef vector<long long>  vll;
typedef pair<ll,ll>        pll;
const ll MOD = 1e9+7;
bool cmp(int X, int Y) {return X > Y;}
 
ll gcd(ll a, ll b) {return !b ? a : gcd(b, a % b);}
ll lcm(ll a, ll b) {return (a / gcd(a, b)) * b;}
ll modpow(ll a, ll b, ll m=MOD){a %= m; ll res = 1; while (b) {if (b & 1)res = (res * a) % m; a = (a * a) % m; b >>= 1;} return res;}
ll bpow(ll a, ll b){if(b<0){return 0;}ll res = 1; while (b) {if (b & 1)res = res * a; a = a * a; b >>= 1;} return res;}
ll modinv(ll a, ll m = MOD) {return modpow(a, m - 2, m);}
 
const int N = 100005;
const int dx4[4] = {0, 1, 0, -1};
const int dy4[4] = {-1, 0, 1, 0};
 
ll vis[N];

ll fact(ll x){
  ll res = 1;
  for(ll i = 1; i<=x ; i++){
    res*=i;
    res = (res+MOD)%MOD;
  }
  return res;
}




int main(){ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
string s;cin>>s;
ll len = s.length();
if(len<3){
  int y = stoi(s);
  if(y%8 == 0){cout<<"Yes"<<endl;}
  else{
    reverse(all(s));
    int tt = stoi(s);
    if(tt%8 == 0){cout<<"Yes";}
    else{
      cout<<"No";
    }
  }
  return 0;
}
vector<ll>se[112];
ll k = 0;

for(ll i = 101; i<1000; i++){
  if(i%8 == 0){
    ll n = i;
    while(n>0){
      ll num = n%10; 
      se[k].push_back(num);
      n = n/10;
    }
    k++;

  }
}
map<ll,ll>cnt;
rep(i,(ll)s.length()){
  cnt[(ll)(s[i] - '0')]++;
}
bool check = false;
for(ll i = 0; i<112; i++){
  bool ch = true;
  map<ll,ll>cnt2;
  for(auto u : se[i]){
    cnt2[u]++;
    

  }
  for(auto u : se[i]){
    if(cnt[u] < cnt2[u]){ch = false;}
  }
  if(ch && (se[i].size() > 0)){check = true;}
}
if(check){
  cout<<"Yes"<<endl;
}else{
  cout<<"No"<<endl;
}




}






