#include <bits/stdc++.h>
using namespace std;
int detec(string s) {
  int x = 0;
  for (int i = 0; i < s.size(); i++) {
    x |= (1 << (s[i] - 'a'));
  }
  return x;
}
int main() {
  string s;
  char d;
  int n;
  cin >> n;
  bool don = false;
  int l = (1 << 26) - 1;
  int cont = 0;
  for (int i = 0; i < n; i++) {
    cin >> d;
    cin >> s;
    int p = detec(s);
    if (d == '.') l &= ~p;
    if (d == '!') l &= p;
    if (d == '?' && i < n - 1) l &= ~p;
    if (don) {
      if (d == '!') cont++;
      if (d == '?' && i < n - 1) cont++;
    }
    if (__builtin_popcount(l) == 1) don = true;
  }
  cout << cont << endl;
  return 0;
}
