#include <bits/stdc++.h>
using namespace std;
char str[100005], t[5];
bool sus[26];
int main() {
  int n, res = 0;
  scanf("%d", &n);
  for (int i = 0; i < 26; i++) sus[i] = 1;
  for (int i = 0, f = 0; i < n; i++) {
    scanf("%s %s", t, str);
    if (i == n - 1) break;
    if (f) {
      res += (t[0] != '.');
      continue;
    }
    int cnt = 0;
    if (t[0] == '!') {
      bool temp[26];
      memset(temp, 0, sizeof temp);
      for (int j = 0; str[j]; j++) temp[str[j] - 'a'] = 1;
      for (int j = 0; j < 26; j++) sus[j] &= temp[j];
      cnt = 0;
      for (int j = 0; j < 26; j++) cnt += sus[j];
    } else if (t[0] == '.') {
      bool temp[26];
      memset(temp, 0, sizeof temp);
      for (int j = 0; str[j]; j++) temp[str[j] - 'a'] = 1;
      for (int j = 0; j < 26; j++) temp[j] ^= 1;
      for (int j = 0; j < 26; j++) sus[j] &= temp[j];
      cnt = 0;
      for (int j = 0; j < 26; j++) cnt += sus[j];
    } else if (sus[str[0] - 'a']) {
      cnt = 0;
      sus[str[0] - 'a'] = 0;
      for (int j = 0; j < 26; j++) cnt += sus[j];
    }
    f = (cnt == 1);
  }
  printf("%d\n", res);
  return 0;
}
