#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, mod = (int)1e9 + 7;
string arr[] = {"ABSINTH", "BEER",    "BRANDY", "CHAMPAGNE", "GIN", "RUM",
                "SAKE",    "TEQUILA", "VODKA",  "WHISKEY",   "WINE"};
int main() {
  ios::sync_with_stdio(0), ios_base::sync_with_stdio(0), cin.tie(0),
      cout.tie(0);
  ;
  int n, cnt = 0;
  cin >> n;
  while (n--) {
    string s;
    cin >> s;
    if (!isdigit(s[0])) {
      for (int k = 0; k <= (int)10; ++k)
        if (arr[k] == s) cnt++;
    } else {
      int a = stoi(s);
      if (a < 18) cnt++;
    }
  }
  cout << cnt << "\n";
  return 0;
}
