#include <bits/stdc++.h>
using namespace std;
int a[30], b[30];
char jd[2], s[100005];
int main() {
  int n;
  scanf("%d", &n);
  memset(a, 1, sizeof(a));
  int cnt = 26, ans = 0;
  while (n--) {
    scanf("%s %s", jd, s);
    if (jd[0] == '!') {
      if (cnt == 1) ans++;
      memset(b, 0, sizeof(b));
      for (int i = 0; i < strlen(s); i++) {
        b[s[i] - 'a'] = 1;
      }
      for (int i = 0; i < 26; i++) {
        if (!b[i] && a[i]) {
          a[i] = 0;
          cnt--;
        }
      }
    } else if (jd[0] == '.') {
      for (int i = 0; i < strlen(s); i++) {
        if (a[s[i] - 'a']) {
          a[s[i] - 'a'] = 0;
          cnt--;
        }
      }
    } else {
      if (cnt == 1 && n != 0) {
        ans++;
        continue;
      }
      if (a[s[0] - 'a']) a[s[0] - 'a'] = 0, cnt--;
    }
  }
  printf("%d\n", ans);
}
