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