#include <bits/stdc++.h>
using namespace std;
template <class T>
int size(const T &x) {
  return x.size();
}
const int INF = ~(1 << 31);
const double EPS = 1e-9;
const double pi = acos(-1);
template <class T>
T smod(T a, T b) {
  return (a % b + b) % b;
}
int f(char c) { return c - 'a'; }
char g(int i) { return (char)(i + 'a'); }
int main() {
  int n;
  cin >> n;
  char c;
  vector<bool> A(26, true);
  int left = 26, cnt = 0;
  for (decltype(0) i = (0); i < (n); ++i) {
    cin >> c;
    if (c == '.') {
      vector<bool> B(26, true);
      string s;
      cin >> s;
      for (decltype(0) j = (0); j < (size(s)); ++j) {
        B[f(s[j])] = false;
      }
      for (decltype(0) j = (0); j < (26); ++j) {
        A[j] = A[j] && B[j];
      }
    } else if (c == '!') {
      if (left == 1) cnt++;
      vector<bool> B(26, false);
      string s;
      cin >> s;
      for (decltype(0) j = (0); j < (size(s)); ++j) {
        B[f(s[j])] = true;
      }
      for (decltype(0) j = (0); j < (26); ++j) {
        A[j] = A[j] && B[j];
      }
    } else {
      char s;
      cin >> s;
      if (left == 1 && i != n - 1) cnt++;
      A[f(s)] = false;
    }
    left = 0;
    for (decltype(0) j = (0); j < (26); ++j) {
      left += A[j];
    }
  }
  cout << cnt << endl;
  return 0;
}
