#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  int tot = 0;
  set<char> possib;
  for (int i = 0; i <= 25; i++) possib.insert(('a' + i));
  for (int u = int(1); u <= int(t); u++) {
    char x;
    cin >> x;
    if (x == '?') {
      char ch;
      cin >> ch;
      if (possib.size() == 1 && u != t)
        tot++;
      else
        possib.erase(ch);
    } else if (x == '.') {
      string s;
      cin >> s;
      for (int i = 0; s[i] != '\0'; i++) possib.erase(s[i]);
    } else if (x == '!') {
      string s;
      cin >> s;
      if (possib.size() == 1) tot++;
      bool freq[26];
      for (int i = int(0); i <= int(25); i++) freq[i] = false;
      for (int i = 0; s[i] != '\0'; i++) freq[(int)(s[i] - 'a')] = true;
      for (int i = int(0); i <= int(25); i++) {
        if (!freq[i]) possib.erase((char)('a' + i));
      }
    }
  }
  cout << tot;
}
