#include <bits/stdc++.h>
using namespace std;
const double eps = 1.0e-8;
const int maxn = 1e6 + 10;
const int maxm = 300;
const int turn[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
long long mod = 1e9 + 7;
int flag = 0;
int cur = 0;
char letter = '.';
int num[30];
int test[30];
unordered_set<char> ans;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  int anser = 0;
  cin >> n;
  char a;
  string b;
  for (int i = 0; i < 26; i++) {
    ans.insert('a' + i);
  }
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (ans.size() == 1) {
      if (a == '!') {
        anser++;
      } else if (a == '?') {
        if (b[0] == letter) {
          break;
        } else if (!ans.count(b[0])) {
          anser++;
        }
      }
      continue;
    }
    if (a == '!') {
      unordered_set<char> now;
      for (char j : b) {
        now.insert(j);
      }
      for (auto it = ans.begin(); it != ans.end();) {
        if (!now.count(*it)) {
          ans.erase(it++);
        } else {
          it++;
        }
      }
    } else {
      for (char j : b) {
        ans.erase(j);
      }
    }
  }
  cout << anser << endl;
}
