#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  set<string> wines = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE",
                       "GIN",     "RUM",     "SAKE",   "TEQUILA",
                       "VODKA",   "WHISKEY", "WINE"};
  int ans = 0;
  for (int i = 0; i < n; i++) {
    string type;
    cin >> type;
    if (isdigit(type[0])) {
      if (stoi(type) < 18) {
        ans++;
      }
    } else {
      if (wines.find(type) != wines.end()) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
