#include <bits/stdc++.h>
using namespace std;
bool v[26];
char s[100001];
int main() {
  int n;
  int suma = 0, i;
  bool gasit = 0;
  bool b = 0;
  char g;
  char c;
  char t;
  cin >> n;
  while (n) {
    cin >> c;
    if (c == '.') {
      cin >> s;
      for (i = 0; s[i]; i++) {
        v[s[i] - 'a'] = 1;
      }
    }
    if (c == '!') {
      if (gasit) suma++;
      cin >> s;
      for (i = 0; i < 26; i++) {
        t = i + 'a';
        if (!strchr(s, t)) v[i] = 1;
      }
    }
    if (c == '?') {
      cin >> c;
      if (n > 1 && gasit) suma++;
      if (n > 1) {
        v[c - 'a'] = 1;
      }
    }
    gasit = 0;
    b = 0;
    for (i = 0; i < 26; i++) {
      if (v[i] == 0 && b == 1) {
        gasit = 0;
      }
      if (v[i] == 0 && b == 0) {
        gasit = 1;
        b = 1;
      }
    }
    n--;
  }
  cout << suma;
  return 0;
}
