#include <bits/stdc++.h>
int main() {
  bool safe[26]{};
  int n;
  std::cin >> n;
  int num_excess = 0;
  int num_safe = 0;
  auto mark_safe = [&](char c) {
    int idx = c - 'a';
    if (!safe[idx]) ++num_safe;
    safe[idx] = true;
  };
  for (int i = 1; i <= n - 1; ++i) {
    char cmd;
    std::cin >> cmd;
    std::string w;
    std::cin >> w;
    if (cmd == '.') {
      for (char c : w) {
        mark_safe(c);
      }
    } else if (cmd == '!') {
      if (num_safe == 25) ++num_excess;
      std::set<char> chars;
      for (char c : w) chars.insert(c);
      for (char c = 'a'; c <= 'z'; ++c) {
        if (!chars.count(c)) {
          mark_safe(c);
        }
      }
    } else if (cmd == '?') {
      if (num_safe == 25) ++num_excess;
      mark_safe(w.front());
    }
  }
  std::cout << num_excess << std::endl;
  return 0;
}
