#include <bits/stdc++.h>
using namespace std;
string Alcohol[11] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                      "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
bool shouldBeChecked(string s) {
  if (s[0] >= 65 && s[0] <= 90) {
    for (int i = 0; i < 11; i++) {
      if (s == Alcohol[i]) return true;
    }
  } else {
    int x;
    stringstream ss;
    ss << s;
    ss >> x;
    if (x < 18) return true;
  }
  return false;
}
int main() {
  int n, check = 0;
  cin >> n;
  string* arr = new string[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (shouldBeChecked(arr[i])) check++;
  }
  cout << check << endl;
}
