#include <bits/stdc++.h>
using namespace std;
inline long long C(int n, int r) {
  if (r > n / 2) r = n - r;
  long long ans = 1;
  int i;
  for (i = 1; i <= r; i++) {
    ans *= n - r + i;
    ans /= i;
  }
  return ans;
}
inline long long power(int a, int b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  long long ans = 1, temp = power(a, b / 2);
  ans = temp;
  if (b % 2) ans *= a;
  return ans;
}
inline vector<string> split(string str, char delimiter) {
  vector<string> internal;
  stringstream ss(str);
  string tok;
  while (getline(ss, tok, delimiter)) {
    internal.push_back(tok);
  }
  return internal;
}
struct sort_pred {
  bool operator()(const std::pair<int, int> &left,
                  const std::pair<int, int> &right) {
    return left.second < right.second;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  map<string, int> m;
  m["ABSINTH"] = 1;
  m["BEER"] = 1;
  m["BRANDY"] = 1;
  m["CHAMPAGNE"] = 1;
  m["GIN"] = 1;
  m["RUM"] = 1;
  m["SAKE"] = 1;
  m["TEQUILA"] = 1;
  m["VODKA"] = 1;
  m["WHISKEY"] = 1;
  m["WINE"] = 1;
  string s;
  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s[0] <= '9' && s[0] >= '0') {
      if (s.length() <= 1)
        count++;
      else if (s.length() >= 3)
        continue;
      else if (s < "18") {
        count++;
      }
    } else if (m[s] == 1) {
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
