#include <bits/stdc++.h>
using namespace std;
int strToIng(string s) {
  int num = 0;
  for (int i = 0; i < (int)s.length(); i++) {
    num *= 10;
    num += s[i] - '0';
  }
  return num;
}
string dri[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main() {
  int x;
  cin >> x;
  vector<string> v(x);
  int c = 0;
  for (int i = 0; (int)i < x; i++) cin >> v[i];
  for (int i = 0; (int)i < v.size(); i++) {
    if (isdigit(v[i][0])) {
      int age = strToIng(v[i]);
      if (age < 18) c++;
    } else {
      for (int j = 0; (int)j < 11; j++) {
        if (v[i] == dri[j]) c++;
      }
    }
  }
  cout << c << endl;
  return 0;
}
