#include <bits/stdc++.h>
using namespace std;
char word[100010];
set<char> may;
set<char> now;
set<char>::iterator I, tI;
int main() {
  int n, len, ans = 0;
  char c;
  cin >> n;
  for (char i = 'a'; i <= 'z'; i++) {
    may.insert(i);
  }
  for (int i = 0; i < n; i++) {
    cin >> c >> word;
    len = strlen(word);
    if (c == '.') {
      for (int j = 0; j < len; j++) {
        may.erase(word[j]);
      }
    } else if (c == '!') {
      if (may.size() == 1) {
        ans++;
      } else {
        now.clear();
        for (int j = 0; j < len; j++) {
          now.insert(word[j]);
        }
        for (I = may.begin(); I != may.end();) {
          if (now.find(*I) == now.end()) {
            tI = I;
            tI++;
            may.erase(I);
            I = tI;
          } else {
            I++;
          }
        }
      }
    } else {
      if (may.size() == 1) {
        if (word[0] != *may.begin()) {
          ans++;
        }
      } else {
        may.erase(word[0]);
      }
    }
  }
  cout << ans;
  return 0;
}
