#include <bits/stdc++.h>
using namespace std;
int n, ans;
string str;
map<string, bool> M;
int main() {
  M["ABSINTH"] = M["BEER"] = M["BRANDY"] = M["CHAMPAGNE"] = M["GIN"] = true;
  M["RUM"] = M["SAKE"] = M["TEQUILA"] = M["VODKA"] = M["WHISKEY"] = M["WINE"] =
      true;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    cin >> str;
    if (M[str]) ans++;
    if ('0' <= str[0] && str[0] <= '9') {
      if (str.length() == 1)
        ans++;
      else if (str.length() == 2 && str[0] == '1' && str[1] < '8')
        ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
