#include <bits/stdc++.h>
using namespace std;
bool func(string s) {
  if (s == "ABSINTH" or s == "BEER" or s == "BRANDY" or s == "CHAMPAGNE" or
      s == "GIN" or s == "RUM" or s == "SAKE" or s == "TEQUILA" or
      s == "VODKA" or s == "WHISKEY" or s == "WINE")
    return true;
  else
    return false;
}
int to_int(string s) {
  int n = 0;
  for (int i = 0; i < s.size(); i++) n = n * 10 + s[i] - 0x30;
  return n;
}
int main() {
  long long cnt = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (func(s) == true) cnt++;
    if (s[0] >= '0' and s[0] <= '9') {
      if (to_int(s) <= 17) cnt++;
    }
  }
  cout << cnt;
}
