#include <bits/stdc++.h>
using namespace std;
int n;
char s[100005];
bool flag[30];
bool flag2[30];
bool ww[30];
int main() {
  memset(flag, true, sizeof(flag));
  scanf("%d", &n);
  int ans = 0;
  bool judge = false;
  for (int i = 1; i <= n; i++) {
    char s2[3];
    scanf("%s%s", s2, s);
    if (i == n) break;
    int len = strlen(s);
    if (judge && (s2[0] == '!' || s2[0] == '?')) {
      ans++;
      continue;
    }
    if (s2[0] == '.') {
      for (int j = 0; j < len; j++) flag[s[j] - 'a'] = false;
    } else if (s2[0] == '!') {
      memset(ww, false, sizeof(ww));
      for (int j = 0; j < len; j++)
        ww[s[j] - 'a'] = true, flag2[s[j] - 'a'] = true;
      for (int j = 0; j < 26; j++)
        if (!ww[j]) flag[j] = false;
    } else if (s2[0] == '?')
      flag[s[0] - 'a'] = false;
    int cnt = 0;
    for (int j = 0; j < 26; j++)
      if (flag[j]) cnt++;
    if (cnt <= 1) judge = true;
  }
  printf("%d\n", ans);
  return 0;
}
