#include <bits/stdc++.h>
using namespace std;
int toInt(string s) {
  stringstream ss(s);
  int n;
  ss >> n;
  return n;
}
string mp[11] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                 "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main() {
  int t;
  scanf("%d", &t);
  string s;
  int r = 0;
  while (t--) {
    cin >> s;
    if (isdigit(s[0])) {
      if (toInt(s) < 18) r++;
    } else {
      for (int i = 0; i < 11; ++i) {
        if (mp[i] == s) {
          r++;
          break;
        }
      }
    }
  }
  cout << r << endl;
  return 0;
}
