#include <bits/stdc++.h>
using namespace std;
char s[100010];
int main() {
  int n, ans = 0, flag = 0;
  cin >> n;
  int s1 = 0, s2 = (1 << 26) - 1;
  while (n--) {
    char op;
    scanf(" %c", &op);
    scanf("%s", s);
    int len = strlen(s);
    if (op == '.') {
      for (int i = 0; i < len; ++i) s1 |= 1 << (s[i] - 'a');
    } else if (op == '!') {
      int tmp = 0;
      for (int i = 0; i < len; ++i) tmp |= 1 << (s[i] - 'a');
      s2 &= tmp;
      if (flag) ++ans;
    } else {
      if (flag && n != 0) ++ans;
      s1 |= 1 << (s[0] - 'a');
    }
    int tt = s2 ^ (s1 & s2);
    if (tt == (tt & (-tt))) flag = 1;
  }
  cout << ans << endl;
  return 0;
}
