#include <bits/stdc++.h>
using namespace std;
set<string> alc = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                   "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int n, a, ans;
string s;
int main() {
  cin >> n;
  while (n--) {
    cin >> s;
    if (isdigit(s[0])) {
      a = stoi(s, nullptr, 10);
      if (a < 18) ans++;
    } else if (alc.find(s) != alc.end())
      ans++;
  }
  cout << ans;
}
