#include <bits/stdc++.h>
using namespace std;
const long long MX = (1 << 20);
using namespace std;
bool isend = 0;
set<char> S;
int ans;
int main() {
  int Q;
  cin >> Q;
  for (char j = 'a'; j <= 'z'; j++) S.insert(j);
  while (Q--) {
    char cmd;
    string w;
    cin >> cmd >> w;
    if (isend) {
      if (Q != 0 && cmd != '.') ++ans;
      continue;
    }
    if (cmd == '.' || cmd == '?') {
      for (auto ch : w) S.erase(ch);
    } else {
      set<char> nset;
      for (auto ch : w)
        if (S.count(ch)) nset.insert(ch);
      S.swap(nset);
    }
    if (S.size() == 1) isend = 1;
  }
  cout << ans << endl;
}
