#include <bits/stdc++.h>
using namespace std;
int chek(string s) {
  if (s.length() < 2) return 1;
  if (s < "18" && s.length() == 2) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string a[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
  int n;
  cin >> n;
  int ans = 0;
  while (n--) {
    string s;
    cin >> s;
    if (s[0] >= 'A' && s[0] <= 'Z') {
      int ok = 0;
      for (long long i = 0; i < 11; i++)
        if (s == a[i]) ok = 1;
      ans += ok;
    } else
      ans += chek(s);
  }
  cout << ans;
  return 0;
}
