#include <bits/stdc++.h>
using namespace std;
const int EPS = 1e-6;
const int INF = (int)(INT_MAX - 100);
const long long mod = (int)(1e+9 + 7);
const int N = (int)(0);
string s[11] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main() {
  int n;
  cin >> n;
  string s2;
  int k = 0, e;
  for (int i = 0; i < n; i++) {
    cin >> s2;
    if (isdigit(s2[0])) {
      istringstream out(s2);
      out >> e;
      k += e < 18;
      continue;
    }
    for (int j = 0; j < 11; j++) k += (s[j] == s2);
  }
  printf("%d\n", k);
  return 0;
}
