#include <bits/stdc++.h>
using namespace std;
ifstream fin("input.txt");
ofstream fout("output.txt");
long long n, i, j, t;
bool isAlcoholicDrink(string drink) {
  return (drink == "ABSINTH" || drink == "BEER" || drink == "BRANDY" ||
          drink == "CHAMPAGNE" || drink == "GIN" || drink == "RUM" ||
          drink == "SAKE" || drink == "TEQUILA" || drink == "VODKA" ||
          drink == "WHISKEY" || drink == "WINE");
}
int convertToAge(string str) {
  int Age = str[str.size() - 1], h = 10;
  for (int k = str.size() - 2; k >= 0; k--) {
    Age += h * (str[k] - '0');
    h *= 10;
  }
  return Age;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  string s;
  stringstream f;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s[0] >= '0' && s[0] <= '9') {
      f << s;
      f >> j;
      f.clear();
      if (j < 18) t++;
    }
    if (isAlcoholicDrink(s)) t++;
  }
  cout << t;
  return 0;
}
