#include <bits/stdc++.h>
using namespace std;
char cand[300];
char aux[300];
int success;
int main() {
  int defined = 0;
  int n;
  cin >> n;
  for (char i = 'a'; i <= 'z'; i++) cand[i] = 1;
  int shocks = 0;
  for (int i = 0; i < n - 1; i++) {
    char action;
    cin >> action;
    string word;
    cin >> word;
    for (char j = 'a'; j <= 'z'; j++) aux[j] = 0;
    for (int j = 0; j < word.size(); j++) {
      aux[word[j]] = 1;
    }
    if (action == '!') {
      if (defined) {
        shocks++;
      } else {
        for (char j = 'a'; j <= 'z'; j++) {
          if (aux[j] == 0) cand[j] = 0;
        }
      }
    } else if (action == '.') {
      if (!defined) {
        for (char j = 'a'; j <= 'z'; j++) {
          if (aux[j] == 1) cand[j] = 0;
        }
      } else {
      }
    } else if (action == '?') {
      cand[word[0]] = 0;
      if (defined) shocks++;
    }
    if (!defined) {
      int cant = 0;
      for (char j = 'a'; j <= 'z'; j++) {
        if (cand[j]) cant++;
      }
      if (cant == 1) defined = 1;
    }
  }
  cout << shocks << '\n';
}
