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