#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  set<char> ss;
  for (int i = 0; i <= 25; i++) {
    char c = 'a';
    ss.insert(c + i);
  }
  string a;
  string b;
  int cnt = 0;
  while (t--) {
    cin >> a >> b;
    if (a[0] == '.') {
      for (int i = 0; i < b.size(); i++) {
        ss.erase(b[i]);
      }
    }
    if (a[0] == '!') {
      if (ss.size() == 1)
        cnt++;
      else {
        set<char> cc;
        for (int i = 0; i < b.size(); i++) {
          if (ss.count(b[i])) cc.insert(b[i]);
        }
        ss = cc;
      }
    }
    if (a[0] == '?') {
      if (ss.size() == 1 && b[0] != *ss.begin()) cnt++;
      ss.erase(b[0]);
    }
  }
  cout << cnt << "\n";
  return 0;
}
