#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  map<string, long long> mp;
  string alc[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                  "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
  for (long long i = 0; i < 11; i++) {
    mp[alc[i]] = 1;
  }
  long long cnt = 0;
  while (n--) {
    string s;
    cin >> s;
    if (s[0] >= '0' && s[0] <= '9') {
      stringstream ss(s);
      long long N;
      ss >> N;
      if (N < 18) cnt++;
      continue;
    }
    if (mp[s]) cnt++;
  }
  cout << cnt << '\n';
  return 0;
}
