#include <bits/stdc++.h>
using ll = long long;
constexpr int N = 2e6 + 5;
int main() {
  int n;
  std::cin >> n;
  std::string answer = "qwertyuiopasdfghjklzxcvbnm";
  int result = 0;
  for (int i = 0; i < n; ++i) {
    char tp;
    std::string st;
    std::cin >> tp;
    if (tp == '!') {
      result += answer.size() == 1;
      std::cin >> st;
      for (int j = 0; j < answer.size(); ++j)
        if (st.find(answer[j]) == -1) answer.erase(answer.begin() + j--);
    } else if (tp == '.') {
      std::cin >> st;
      for (int j = 0; j < answer.size(); ++j)
        if (st.find(answer[j]) != -1) answer.erase(answer.begin() + j--);
    } else {
      std::cin >> st;
      if (answer.size() == 1 && st != answer) ++result;
      int p = answer.find(st);
      if (p != -1) answer.erase(answer.begin() + p);
    }
  }
  std::cout << result;
}
