#include <bits/stdc++.h> using namespace std; int main(){int n,x,c=0;cin>>n;while(n--){cin>>x;if(x%9==0&&x%8)c++;}cout<<c<<"\n";}