#include <bits/stdc++.h>
using namespace std;
string l[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
              "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main(void) {
  int n;
  cin >> n;
  int res = 0;
  for (int i = 0; i < n; i++) {
    string temp;
    cin >> temp;
    if (isdigit(temp[0])) {
      stringstream tin(temp);
      int adad;
      tin >> adad;
      if (adad < 18) res++;
    } else {
      bool isgood = false;
      for (int i = 0; i < 11; i++) {
        if (temp == l[i]) {
          isgood = true;
          break;
        }
      }
      if (isgood) res++;
    }
  }
  cout << res << endl;
  return 0;
}
