#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n;
  cin >> n;
  int k = 'z' - 'a' + 1;
  bool c[1000];
  int res = 0;
  fill(begin(c), end(c), true);
  while (n--) {
    char op;
    string w;
    cin >> op >> w;
    switch (op) {
      case '!':
        if (k == 1) {
          res++;
          continue;
        }
        k = 0;
        for (int i = 'a'; i <= 'z'; ++i) {
          c[i] &= w.find(i) != string::npos;
          if (c[i]) {
            k++;
          }
        }
        break;
      case '.':
        k = 0;
        for (int i = 'a'; i <= 'z'; ++i) {
          c[i] &= w.find(i) == string::npos;
          if (c[i]) k++;
        }
        break;
      case '?':
        if (n > 0) {
          if (k == 1) res++;
          if (c[w[0]]) k--;
          c[w[0]] = false;
        }
        break;
    }
  }
  cout << res << endl;
  return 0;
}
