#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int unsafe = (1 << 26) - 1;
  int ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    char t;
    cin >> t;
    if (t == '.') {
      string w;
      cin >> w;
      int mask = 0;
      for (char c : w) mask |= 1 << (c - 'a');
      unsafe &= ~mask;
    } else if (t == '!') {
      if (!(unsafe & (unsafe - 1))) ++ans;
      string w;
      cin >> w;
      int mask = 0;
      for (char c : w) mask |= 1 << (c - 'a');
      unsafe &= mask;
    } else if (t == '?') {
      if (!(unsafe & (unsafe - 1))) ++ans;
      char s;
      cin >> s;
      unsafe &= ~(1 << (s - 'a'));
    }
  }
  cout << ans << '\n';
  return 0;
}
