#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using lint = long long;
using ti = tuple<int, int, int>;
const int N = 1e5 + 7;
const int M = 26;
char s[N];
int e[M];
int get() {
  int re = 0;
  for (int i = 0; i < M; i++)
    if (e[i]) ++re;
  return re;
}
int main() {
  int n;
  scanf("%d", &n);
  char b[2];
  bool ok = false;
  int ans = 0;
  for (int i = 0; i < M; i++) e[i] = 1;
  for (int i = 0; i < n; i++) {
    scanf("%s%s", b, s);
    int len = strlen(s);
    vector<bool> c(M);
    for (int i = 0; i < len; i++) {
      c[s[i] - 'a'] = true;
    }
    if (b[0] == '?') {
      if (i == n - 1) {
      } else {
        e[s[0] - 'a'] = 0;
        if (ok) ++ans;
      }
    } else if (b[0] == '.') {
      for (int j = 0; j < M; j++) {
        if (c[j]) e[j] = 0;
      }
    } else if (b[0] == '!') {
      for (int j = 0; j < M; j++) {
        if (!c[j]) e[j] = 0;
      }
      if (ok) ++ans;
    }
    if (get() == 1) {
      ok = true;
    }
  }
  printf("%d\n", ans);
  return 0;
}
