#include <bits/stdc++.h>
using namespace std;
int n;
string type[100001];
string str[100001];
bool flag[30];
bool now[30];
int cnt = 26;
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < 26; i++) {
    now[i] = true;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> type[i] >> str[i];
    if (i == n - 1) continue;
    memset(flag, false, sizeof(flag));
    if (type[i] == ".") {
      for (int j = 0; j < str[i].size(); j++) {
        flag[str[i][j] - 'a'] = true;
      }
      for (int j = 0; j < 26; j++) {
        if (now[j] && flag[j]) {
          now[j] = false;
          cnt--;
        }
      }
    }
    if (type[i] == "!") {
      if (cnt == 1) ans++;
      for (int j = 0; j < str[i].size(); j++) {
        flag[str[i][j] - 'a'] = true;
      }
      for (int j = 0; j < 26; j++) {
        if (now[j] && !flag[j]) {
          now[j] = false;
          cnt--;
        }
      }
    }
    if (type[i] == "?") {
      for (int j = 0; j < str[i].size(); j++) {
        flag[str[i][j] - 'a'] = true;
      }
      int tmp = 0;
      for (int j = 0; j < 26; j++) {
        if (flag[j] && now[j]) tmp++;
      }
      if (cnt == 1 && tmp == 0) ans++;
      if (now[str[i][0] - 'a']) {
        cnt--;
        now[str[i][0] - 'a'] = false;
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
