#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  bool solved = false;
  int ans = 0;
  bitset<26> can;
  can.set();
  for (int i = 1; i < n; i++) {
    char act;
    cin >> act;
    if (act == '?') {
      char c;
      cin >> c;
      if (solved) {
        ans++;
      }
      can.reset(c - 'a');
    } else {
      string s;
      cin >> s;
      bitset<26> mask;
      for (char c : s) {
        mask.set(c - 'a');
      }
      if (act == '!') {
        can &= mask;
        if (solved) {
          ans++;
        }
      } else {
        can &= ~mask;
      }
    }
    if (can.count() == 1) {
      solved = true;
    }
  }
  cout << ans;
  return 0;
}
