#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; c < 48 || c > 57; c = getchar())
    if (c == '-') f = -1;
  for (; c > 47 && c < 58; c = getchar()) x = x * 10 + c - 48;
  return x;
}
int n, fl, ans;
string a, s;
int f[255], g[255];
inline void init() {
  n = read();
  for (int i = 1; i < n; ++i) {
    cin >> a >> s;
    if (fl == 25 && a != ".") ++ans;
    memset(g + 'a', 0, 26 << 2);
    for (int j = 0; j < s.size(); ++j) g[s[j]] = 1;
    if (a == "!") {
      for (int j = 'a'; j <= 'z'; ++j)
        if (!g[j]) f[j] = 1;
    } else if (a == ".") {
      for (int j = 'a'; j <= 'z'; ++j)
        if (g[j]) f[j] = 1;
    } else
      f[s[0]] = 1;
    fl = 0;
    for (int j = 'a'; j <= 'z'; ++j) fl += f[j];
  }
  printf("%d\n", ans);
}
inline void solve() {}
int main() {
  init();
  solve();
  return 0;
}
