#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, n, i, k, m, j, ans = 0;
  string s, s1;
  cin >> a;
  for (i = 1; i <= a; i++) {
    cin >> s;
    if (s == "ABSINTH") ans++;
    if (s == "BEER") ans++;
    if (s == "BRANDY") ans++;
    if (s == "CHAMPAGNE") ans++;
    if (s == "GIN") ans++;
    if (s == "RUM") ans++;
    if (s == "SAKE") ans++;
    if (s == "TEQUILA") ans++;
    if (s == "VODKA") ans++;
    if (s == "WHISKEY") ans++;
    if (s == "WINE") ans++;
    b = 0;
    k = 0;
    for (j = 0; j < s.size(); j++) {
      if (s[j] - 48 >= 0 && s[j] - 48 <= 9) {
        b = b * 10 + s[j] - 48;
        k++;
      }
    }
    if (b < 18 && k > 0) {
      ans++;
    }
  }
  cout << ans;
}
