#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int ans = 0;
  unordered_map<string, int> u;
  u["ABSINTH"] = 1;
  u["BEER"] = 1;
  u["BRANDY"] = 1;
  u["CHAMPAGNE"] = 1;
  u["GIN"] = 1;
  u["RUM"] = 1;
  u["SAKE"] = 1;
  u["TEQUILA"] = 1;
  u["VODKA"] = 1;
  u["WHISKEY"] = 1;
  u["WINE"] = 1;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s[0] >= '0' && s[0] <= '9') {
      int age = stoi(s);
      if (age < 18) {
        ans++;
      }
    } else if (u.find(s) != u.end()) {
      ans++;
    }
  }
  cout << ans;
}
