#include<bits/stdc++.h> using namespace std; int cnt,b; int main() { string str,s; cin>>s; b=stoi(s); while (cin>>str) { int a=stoi(str); if (str.size()==s.size()&&abs(a-b)%32==0) cnt++; } cout<<cnt; return 0; }