#include <bits/stdc++.h>
using namespace std;
int main() {
  map<string, bool> al;
  al["ABSINTH"] = 1, al["BEER"] = 1, al["BRANDY"] = 1, al["CHAMPAGNE"] = 1;
  al["GIN"] = 1, al["RUM"] = 1, al["SAKE"] = 1, al["TEQUILA"] = 1,
  al["VODKA"] = 1;
  al["WHISKEY"] = 1, al["WINE"] = 1;
  string s;
  int n, c = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (isdigit(s[0])) {
      int k = 0, m = 1;
      for (int l = 0; l < s.size(); l++) k *= 10, k += (s[l] - '0');
      if (k < 18) c++;
    }
    if (al[s]) c++;
  }
  cout << c;
}
