#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  std::cin >> n;
  bool letters[26];
  bool d = false;
  int extra = 0;
  for (int i = 0; i < 26; i++) {
    letters[i] = true;
  }
  char action;
  string input = "";
  for (int i = 0; i < n; i++) {
    cin >> action;
    cin >> input;
    if (action == '!') {
      for (int j = 0; j < 26; j++) {
        if (strchr(input.c_str(), j + 'a') == NULL) {
          letters[j] = false;
        }
      }
      if (d == true) extra++;
    }
    if (action == '.') {
      for (int j = 0; j < 26; j++) {
        if (strchr(input.c_str(), j + 'a') != NULL) {
          letters[j] = false;
        }
      }
    }
    if (action == '?') {
      letters[input[0] - 'a'] = false;
      if (d == true && i < n - 1) extra++;
    }
    if (d == false) {
      int truec = 0;
      for (int j = 0; j < 26; j++) {
        if (letters[j] == true) {
          truec++;
        }
      }
      if (truec == 1) {
        d = true;
      }
    }
  }
  cout << extra << endl;
  return 0;
}
