#include <bits/stdc++.h>
using namespace std;
const int m = 40;
const int maxn = (int)1e5 + 44;
int n, len, tag[m], flag[m];
char str[maxn];
bool ed;
int main() {
  char op[2];
  int ans = 0;
  for (int i = 0; i < 26; i++) flag[i] = 1;
  scanf("%d", &n);
  ed = false;
  for (int i = 1; i < n; i++) {
    scanf("%s%s", op, str);
    len = strlen(str);
    if (op[0] == '!') {
      if (ed) {
        ans++;
        continue;
      }
      memset(tag, 0, sizeof(tag));
      for (int j = 0; j < len; j++) tag[str[j] - 'a']++;
      for (int j = 0; j < 26; j++)
        if (tag[j] == 0) flag[j] = 0;
    } else if (op[0] == '.') {
      if (ed) continue;
      for (int j = 0; j < len; j++) flag[str[j] - 'a'] = 0;
    } else {
      if (ed) {
        ans++;
        continue;
      }
      for (int j = 0; j < len; j++) flag[str[j] - 'a'] = 0;
    }
    if (ed == 0) {
      int tmp = 0;
      for (int i = 0; i < 26; i++)
        if (flag[i]) tmp++;
      if (tmp == 1) ed = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
