#include <bits/stdc++.h>
using namespace std;
char a[3], b[100005];
int v[26], t[26], n, ans, fg, cnt, i;
int main() {
  scanf("%d", &n);
  for (i = 0; i < 26; i++) v[i] = 1;
  while (--n) {
    scanf("%s%s", a, b);
    if (fg) {
      ans += (a[0] != '.');
      continue;
    }
    if (a[0] == '?') {
      v[b[0] - 'a'] = 0;
      for (cnt = i = 0; i < 26; i++) cnt += v[i];
      if (cnt == 1) fg = 1;
    } else {
      if (a[0] == '.') {
        for (i = 0; i < 26; i++) t[i] = 1;
        for (i = 0; b[i]; i++) t[b[i] - 'a'] = 0;
      } else {
        for (i = 0; i < 26; i++) t[i] = 0;
        for (i = 0; b[i]; i++) t[b[i] - 'a'] = 1;
      }
      for (cnt = i = 0; i < 26; i++) v[i] *= t[i], cnt += v[i];
      if (cnt == 1) fg = 1;
    }
  }
  scanf("%s%s", a, b);
  printf("%d", ans);
}
