#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  {
    int n;
    cin >> n;
    int ans = 0;
    while (n--) {
      string s;
      cin >> s;
      if (s[0] - 'A' >= 0 && s[0] - 'A' < 26) {
        if (s == "ABSINTH" || s == "BEER" || s == "BRANDY" ||
            s == "CHAMPAGNE" || s == "GIN" || s == "RUM" || s == "SAKE" ||
            s == "TEQUILA" || s == "VODKA" || s == "WHISKEY" || s == "WINE") {
          ans++;
        }
      } else {
        int x = stoi(s);
        if (x < 18) {
          ans++;
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
