#include <bits/stdc++.h>
int a[30];
bool b[30];
char s1[3], s2[100005];
int main() {
  int m, ans = 0;
  scanf("%d", &m);
  bool flag = false;
  while (m--) {
    scanf("%s%s", s1, s2);
    memset(b, 0, sizeof(b));
    if (s1[0] == '!') {
      if (flag) ++ans;
      for (int i = 0; s2[i]; i++) b[s2[i] - 'a'] = true;
      for (int i = 0; i < 26; i++)
        if (a[i] != -1) a[i] += b[i];
    }
    if (s1[0] == '?') {
      if (flag) ++ans;
      a[s2[0] - 'a'] = -1;
    }
    if (s1[0] == '.')
      for (int i = 0; s2[i]; i++) a[s2[i] - 'a'] = -1;
    int mx = -2, tot = 0;
    if (flag) continue;
    for (int i = 0; i < 26; i++)
      if (a[i] > mx) mx = a[i];
    for (int i = 0; i < 26; i++)
      if (a[i] == mx) ++tot;
    for (int i = 0; i < 26; i++)
      if (a[i] != mx) a[i] = -1;
    if (tot == 1) flag = true;
  }
  if (ans == 0) ++ans;
  printf("%d", ans - 1);
}
