#include <bits/stdc++.h>
using namespace std;
int tobin(string s) {
  int ans = 0;
  for (int i = 0; i < s.size(); i++) {
    ans |= 1 << (s[i] - 'a');
  }
  return ans;
}
int main() {
  int n, mask, save = 0;
  cin >> n;
  mask = (1 << 26) - 1;
  while (n--) {
    char c, c2;
    string s;
    cin >> c;
    if (c == '.') {
      cin >> s;
      mask &= ~tobin(s);
    }
    if (c == '!') {
      if (__builtin_popcount(mask) == 1) save++;
      cin >> s;
      mask &= tobin(s);
    }
    if (c == '?') {
      if (__builtin_popcount(mask) == 1 && n != 0) save++;
      cin >> c2;
      mask &= ~(1 << (int)(c2 - 'a'));
    }
  }
  cout << save << "\n";
  return 0;
}
