#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  while (cin >> T) {
    set<char> word;
    for (int i = 'a'; i <= 'z'; i++) word.insert(i);
    set<char>::iterator it;
    int deter = 0, sum = 0;
    for (int i = 0; i < T; i++) {
      char c;
      string s;
      cin >> c >> s;
      if (i == T - 1) break;
      if (deter) {
        if (c == '!' || c == '?') sum++;
        continue;
      }
      switch (c) {
        case '!': {
          set<char> temp;
          for (int j = 0; j < s.length(); j++) temp.insert(s[j]);
          for (int j = 'a'; j <= 'z'; j++)
            if (word.count(j) != 0 && temp.count(j) == 0) word.erase(j);
          break;
        }
        case '.':
          for (int j = 0; j < s.length(); j++)
            if (word.count(s[j])) word.erase(s[j]);
          break;
        case '?':
          if (word.count(s[0])) word.erase(s[0]);
          break;
      }
      if (word.size() == 1) deter = 1;
    }
    cout << sum << endl;
  }
  return 0;
}
