#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
char arr[N];
int main() {
  int n, ans = 0;
  scanf("%d", &n);
  set<char> pos;
  for (char c = 'a'; c <= 'z'; c++) pos.insert(c);
  for (int i = 0; i < n - 1; i++) {
    char ch;
    scanf(" %c", &ch);
    if (ch == '!') {
      scanf(" %s", arr);
      if (pos.size() == 1) {
        ans++;
        continue;
      };
      set<char> temp;
      int l = strlen(arr);
      for (int j = 0; j < l; j++)
        if (pos.find(arr[j]) != pos.end()) temp.insert(arr[j]);
      swap(temp, pos);
    } else if (ch == '.') {
      scanf(" %s", arr);
      int l = strlen(arr);
      for (int j = 0; j < l; j++) pos.erase(arr[j]);
    } else {
      scanf(" %c", &ch);
      if (pos.size() == 1) {
        ans++;
        continue;
      }
      pos.erase(ch);
    }
  }
  cout << ans << endl;
  return 0;
}
