#include <bits/stdc++.h>
using namespace std;
int main() {
  int e, i, flag, n;
  cin >> n;
  char a;
  string s;
  bitset<26> b;
  e = 0;
  flag = 0;
  while (n--) {
    cin >> a;
    cin >> s;
    if (a == '.') {
      for (i = 0; s[i] != '\0'; i++) b[int(s[i] - 'a')] = 1;
    }
    if (a == '!') {
      bitset<26> c;
      c.set();
      for (i = 0; s[i] != '\0'; i++) c[int(s[i] - 'a')] = 0;
      b = b | c;
      if (flag) e++;
    }
    if (a == '?' && n != 0) {
      b[s[0] - 'a'] = 1;
      if (flag) e++;
    }
    if (b.size() - b.count() == 1) flag = 1;
  }
  cout << e;
}
