#include <bits/stdc++.h>
using namespace std;
void fileIO() {}
bool sortbysecdesc(const pair<long long, long long> &a,
                   const pair<long long, long long> &b) {
  return a.second > b.second;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  fileIO();
  long long T;
  T = 1;
  while (T--) {
    long long n;
    cin >> n;
    unordered_set<string> s;
    string alc[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                    "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
    for (long long i = 0; i < 11; i++) {
      s.insert(alc[i]);
    }
    long long check = 0;
    for (long long i = 0; i < n; i++) {
      string input;
      cin >> input;
      if (s.find(input) != s.end()) {
        check++;
      } else if (input[0] > '9' || input[0] < '0')
        continue;
      else {
        long long num = 0;
        long long len = input.size();
        for (long long j = 0; j < len; j++) {
          num = num * 10 + (input[j] - '0');
        }
        if (num < 18) check++;
      }
    }
    cout << check;
  }
  return 0;
}
