#include <bits/stdc++.h>
using namespace std;
int turns(int x, int y) {
  if (x > 0 && y > 0 && x == y)
    return 1 + (x - 1) * 4;
  else if (x < 0 && y > 0 && abs(x) == y)
    return 2 + (y - 1) * 4;
  else if (x < 0 && y < 0 && x == y)
    return 3 + (abs(x) - 1) * 4;
  else
    return 4 * abs(y);
}
void solve() {
  int n, c{};
  cin >> n;
  vector<string> v = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                      "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    int a = s[0] - 48;
    if (a >= 0 && a <= 9) {
      int x = stoi(s);
      if (x < 18) c++;
    } else {
      if (find(v.begin(), v.end(), s) != v.end()) c++;
    }
  }
  cout << c << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long q = 1;
  while (q--) {
    solve();
  }
  return 0;
}
