#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s == "ABSINTH" || s == "BEER" || s == "BRANDY" || s == "CHAMPAGNE" ||
        s == "GIN" || s == "RUM" || s == "SAKE" || s == "TEQUILA" ||
        s == "VODKA" || s == "WHISKEY" || s == "WINE")
      ans++;
    if (s[0] <= '9' && s[0] >= '0') {
      int x;
      x = s[0] - '0';
      for (int j = 1; j < s.size(); j++) x = x * 10 + (s[j] - '0');
      if (x < 18) ++ans;
    }
  }
  cout << ans;
  return 0;
}
