#include <bits/stdc++.h>
using namespace std;
map<string, int> ma;
void init() {
  ma["ABSINTH"] = 1, ma["BEER"] = 1, ma["BRANDY"] = 1, ma["CHAMPAGNE"] = 1,
  ma["GIN"] = 1, ma["RUM"] = 1, ma["SAKE"] = 1;
  ma["TEQUILA"] = 1, ma["VODKA"] = 1, ma["WHISKEY"] = 1, ma["WINE"] = 1;
}
int main() {
  int n, sum, m;
  init();
  while (scanf("%d", &n) != EOF) {
    string s;
    sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> s;
      if (isdigit(s[0])) {
        m = atoi(s.c_str());
        if (m < 18) sum++;
      } else if (ma[s])
        sum++;
    }
    cout << sum << "\n";
  }
  return 0;
}
