#include <bits/stdc++.h>
long long int power(int base, int n);
int make_number(char str[], int n, int number_system);
int main() {
  int i, j, k, m, n, length, age, count;
  char alcohol[50][105] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE",
                           "GIN",     "RUM",     "SAKE",   "TEQUILA",
                           "VODKA",   "WHISKEY", "WINE"};
  char name[105];
  scanf("%d ", &n);
  for (i = 0, count = 0; i < n; i++) {
    scanf("%s", name);
    if (name[0] <= '9' && name[0] >= '0') {
      length = strlen(name) - 1;
      age = make_number(name, length, 10);
      if (age < 18) count++;
    } else
      for (j = 0; j < 11; j++) {
        if (strcmp(alcohol[j], name) == 0) {
          count++;
          break;
        }
      }
  }
  printf("%d\n", count);
  return 0;
}
int make_number(char str[], int n, int number_system) {
  int i, sum = 0, intrinsic;
  if (str[n] <= 'Z' && str[n] >= 'A')
    for (i = 0; str[n] <= 'Z' && str[n] >= 'A'; n--, i++) {
      intrinsic = str[n] - 'A';
      sum = sum + intrinsic * power(number_system, i);
    }
  else if (str[n] <= '9' && str[n] >= '0')
    for (i = 0; str[n] <= '9' && str[n] >= '0'; n--, i++) {
      intrinsic = str[n] - '0';
      sum = sum + intrinsic * power(number_system, i);
    }
  return sum;
}
long long int power(int base, int n) {
  int i, sum = 1;
  for (i = 0; i < n; i++) {
    sum = sum * base;
  }
  return sum;
}
