#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007;
string s;
bool Judge() {
  if (s == "ABSINTH" || s == "BEER" || s == "BRANDY" || s == "CHAMPAGNE" ||
      s == "GIN" || s == "RUM" || s == "SAKE" || s == "TEQUILA" ||
      s == "VODKA" || s == "WHISKEY" || s == "WINE") {
    return true;
  }
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (s[0] >= '0' && s[0] <= '9') {
      if (s.length() == 1) {
        ans++;
      }
      if (s.length() == 2) {
        if (s[0] == '0') {
          ans++;
        } else if (s[0] == '1' && s[1] < '8') {
          ans++;
        }
      }
    } else if (Judge()) {
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
