#include <bits/stdc++.h>
using namespace std;
char liquor[11][255] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE",
                        "GIN",     "RUM",     "SAKE",   "TEQUILA",
                        "VODKA",   "WHISKEY", "WINE"};
int main() {
  int ncase;
  int res = 0;
  char buf[255];
  cin >> ncase;
  while (ncase-- > 0) {
    cin >> buf;
    bool ck = true;
    int age = 0;
    for (int i = 0; buf[i] != '\0'; i++) {
      if ('0' <= buf[i] && buf[i] <= '9')
        age = age * 10 + int(buf[i] - '0');
      else {
        ck = false;
        break;
      }
    }
    if (ck) {
      if (age < 18) res++;
    } else {
      bool al = false;
      for (int i = 0; i < 11; i++) {
        if (!strcmp(buf, liquor[i])) al = true;
      }
      if (al) res++;
    }
  }
  cout << res << endl;
  return 0;
}
