#include <bits/stdc++.h>
using namespace std;
const int INF = 2147483640;
const long long LINF = 9223372036854775800;
int main() {
  map<string, int> cnt;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string tmp;
    cin >> tmp;
    ++cnt[tmp];
  }
  int res = 0;
  string mas[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                  "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
  for (int i = 0; i < 11; ++i) {
    res += cnt[mas[i]];
  }
  for (map<string, int>::iterator t = cnt.begin(); t != cnt.end(); ++t) {
    if (isdigit(t->first[0]) && atoi(t->first.c_str()) < 18) {
      res += t->second;
    }
  }
  cout << res << endl;
  return 0;
}
