#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<string> str = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE",
                        "GIN",     "RUM",     "SAKE",   "TEQUILA",
                        "VODKA",   "WHISKEY", "WINE"};
  string s;
  int n, i, counter = 0;
  cin >> n;
  while (n--) {
    cin >> s;
    if (isdigit(s[0]))
      counter += atoi(s.c_str()) < 18;
    else
      counter += binary_search(str.begin(), str.end(), s);
  }
  cout << counter << endl;
  return 0;
}
