#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    int num = 0;
    for (int i = s.length() - 1; i >= 0; i--) {
      if (isdigit(s[i])) {
        int x = ((int)s[i]) - 48;
        num += ((int)pow(10, (s.length() - i - 1))) * x;
      } else {
        num = -1;
        break;
      }
    }
    if (num < 18 && num >= 0) {
      ans++;
    } else if (num == -1) {
      if (s == "ABSINTH" || s == "BEER" || s == "BRANDY" || s == "CHAMPAGNE" ||
          s == "GIN" || s == "RUM" || s == "SAKE" || s == "TEQUILA" ||
          s == "VODKA" || s == "WHISKEY" || s == "WINE")
        ans++;
    }
  }
  cout << ans << endl;
}
