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