#include <bits/stdc++.h>
using namespace std;
const string arr[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                      "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int res = 0;
  int tmp = 0;
  while (tmp < n) {
    int a;
    cin >> a;
    if (!cin.fail()) {
      if (a < 18) {
        res++;
      }
    } else {
      cin.clear();
      string str;
      cin >> str;
      if (find(arr, arr + 11, str) != arr + 11) {
        res++;
      }
    }
    tmp++;
  }
  cout << res << endl;
  return 0;
}
