#include <bits/stdc++.h>
using namespace std;
bool c[32], c2[32];
char w[100200];
int sure = 0, ans = 0;
void notp(char ch) {
  if (c[ch - 'a']) {
    c[ch - 'a'] = 0;
    ++sure;
  }
  return;
}
int main() {
  for (int i = 0; i < 26; ++i) {
    c[i] = 1;
  }
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; ++i) {
    char a;
    cin >> a;
    if (a == '?') {
      if (sure >= 25) {
        ++ans;
      }
      char b;
      cin >> b;
      notp(b);
    }
    if (a == '!') {
      cin >> w;
      if (sure >= 25) {
        ++ans;
      }
      int m = strlen(w);
      for (int j = 0; j < 26; ++j) {
        c2[j] = 1;
      }
      for (int j = 0; j < m; ++j) {
        c2[w[j] - 'a'] = 0;
      }
      for (int j = 0; j < 26; ++j) {
        if (c2[j]) {
          notp(j + 'a');
        }
      }
    }
    if (a == '.') {
      cin >> w;
      int m = strlen(w);
      for (int j = 0; j < m; ++j) {
        notp(w[j]);
      }
    }
  }
  cout << ans << "\n";
  return 0;
}
