#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  bool pos[26];
  for (int i = 0; i < 26; i++) {
    pos[i] = true;
  }
  int n;
  cin >> n;
  int ans = 0;
  for (int z = 0; z < n; z++) {
    string ss;
    cin >> ss;
    string str;
    cin >> str;
    bool in[26];
    for (int i = 0; i < 26; i++) {
      in[i] = false;
    }
    for (int i = 0; i < str.length(); i++) {
      in[(int)(str[i] - 'a')] = true;
    }
    int active = 0;
    for (int i = 0; i < 26; i++) {
      if (pos[i]) {
        active++;
      }
    }
    if (ss == ".") {
      for (int i = 0; i < 26; i++) {
        pos[i] &= !in[i];
      }
    } else if (ss == "!") {
      if (active == 1) {
        ans++;
      }
      for (int i = 0; i < 26; i++) {
        pos[i] &= in[i];
      }
    } else {
      if (active == 1 && z != n - 1) {
        ans++;
      }
      pos[(int)(str[0] - 'a')] = false;
    }
  }
  cout << ans << endl;
  return 0;
}
