#include <bits/stdc++.h>
using namespace std;
string g;
int main() {
  int n, s = 0, i, v, j;
  scanf("%d\n", &n);
  for (i = 0; i < n; i++) {
    cin >> g;
    if (i + 1 != n) scanf("\n");
    if (g[0] >= '0' && g[0] <= '9') {
      v = 0;
      for (j = 0; j < g.length(); j++) {
        v *= 10;
        v += g[j] - '0';
      }
      if (v < 18) s++;
    } else {
      if (g == "ABSINTH" || g == "BEER" || g == "BRANDY" || g == "CHAMPAGNE" ||
          g == "GIN" || g == "RUM" || g == "SAKE" || g == "TEQUILA" ||
          g == "VODKA" || g == "WHISKEY" || g == "WINE")
        s++;
    }
  }
  printf("%d", s);
  return 0;
}
