#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  set<char> mi, nope;
  for (char c = 'a'; c <= 'z'; c++) mi.insert(c);
  string a, b;
  int i;
  for (i = 0; i < n; i++) {
    cin >> a >> b;
    if (a[0] == '!') {
      int fr[208] = {0};
      for (int j = 0; b[j]; j++) {
        fr[b[j]] = 1;
      }
      for (int j = 0; j < 208; j++) {
        char xy = j;
        if (mi.count(xy) && fr[j] == 0) mi.erase(xy);
      }
    } else if (a[0] == '.') {
      int fr[208] = {0};
      for (int j = 0; b[j]; j++) {
        fr[b[j]] = 1;
      }
      for (int j = 0; j < 208; j++) {
        char xy = j;
        if (mi.count(xy) && fr[j] == 1) mi.erase(xy);
      }
    } else {
      if (i != n - 1) {
        if (mi.count(b[0])) mi.erase(b[0]);
      }
    }
    if (mi.size() == 1) {
      break;
    }
  }
  i++;
  int ans = 0;
  for (; i < n; i++) {
    cin >> a >> b;
    if (a[0] == '!') ans++;
    if (a[0] == '?' && i != n - 1) ans++;
  }
  cout << ans << endl;
  return 0;
}
