#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n;
char op[10];
char s[N];
bool safe[N], temp[N];
int main() {
  int ans = 0;
  bool konw = false;
  scanf("%d", &n);
  while (n--) {
    scanf("%s%s", op, s);
    if (op[0] == '.') {
      for (int i = 0; s[i]; i++) safe[s[i]] = true;
    }
    if (op[0] == '!') {
      memset(temp, false, sizeof(temp));
      for (int i = 0; s[i]; i++) temp[s[i]] = true;
      for (int i = 'a'; i <= 'z'; i++)
        if (!temp[i]) safe[i] = true;
      if (konw) ans++;
    }
    if (op[0] == '?') {
      if (konw && safe[s[0]])
        ans++;
      else
        safe[s[0]] = true;
    }
    int cnt = 0;
    for (int i = 'a'; i <= 'z'; i++)
      if (!safe[i]) cnt++;
    if (cnt == 1) konw = true;
  }
  printf("%d\n", ans);
}
