#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string x;
  vector<string> d;
  vector<int> a;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    if (isdigit(x[0]) == 0)
      d.push_back(x);
    else
      a.push_back(stoi(x));
  }
  int c = 0;
  for (int t : a) {
    if (t < 18) c++;
  }
  for (string t : d) {
    if (t == "ABSINTH" || t == "BEER" || t == "BRANDY" || t == "CHAMPAGNE" ||
        t == "GIN" || t == "RUM" || t == "SAKE" || t == "TEQUILA" ||
        t == "VODKA" || t == "WHISKEY" || t == "WINE")
      c++;
  }
  cout << c;
}
