#include <bits/stdc++.h>
int main() {
  char s[100100], x[5];
  int n, flag, ans, len, sum, i, j, z, flag_letter, vis[30], vist[30];
  while (~scanf("%d", &n)) {
    memset(vist, 0, sizeof(vist));
    flag = 0;
    ans = 0;
    for (i = 0; i < n; i++) {
      scanf("%s", x);
      scanf("%s", s);
      len = strlen(s);
      if (x[0] == '!') {
        if (flag) {
          ans++;
          continue;
        }
        sum = 0;
        memset(vis, 0, sizeof(vis));
        for (j = 0; j < len; j++) vis[s[j] - 'a'] = 1;
        for (j = 0; j < 26; j++)
          if (!vis[j]) vist[j] = 1;
        for (j = 0; j < 26; j++)
          if (!vist[j]) sum++, z = j;
        if (sum == 1) flag = 1, flag_letter = z;
      }
      if (x[0] == '?') {
        if (flag && i != n - 1 && (s[0] - 'a') != flag_letter) {
          ans++;
          continue;
        }
        vist[s[0] - 'a'] = 1;
        sum = 0;
        for (j = 0; j < 26; j++)
          if (!vist[j]) sum++, z = j;
        if (sum == 1) flag = 1, flag_letter = z;
      }
      if (x[0] == '.') {
        if (flag) continue;
        for (j = 0; j < len; j++) vist[s[j] - 'a'] = 1;
        sum = 0;
        for (j = 0; j < 26; j++)
          if (!vist[j]) sum++, z = j;
        if (sum == 1) flag = 1, flag_letter = z;
      }
    }
    printf("%d\n", ans);
  }
}
