#include <bits/stdc++.h>
using namespace std;
map<string, bool> alcohol;
string a[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
              "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main() {
  for (int i = 0; i < 11; i++) alcohol[a[i]] = true;
  int n;
  cin >> n;
  int ans = 0;
  while (n--) {
    string line;
    cin >> line;
    if (isdigit(line[0])) {
      int age = atoi(line.c_str());
      if (age < 18) ans++;
    }
    if (alcohol[line]) ans++;
  }
  cout << ans;
  return 0;
}
