#include <bits/stdc++.h>
using namespace std;
int n, d[205], p[205];
char type;
string x;
int main() {
  cin >> n;
  int m, cnt = 0, cur = 26, res = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> type;
    cin >> x;
    if (type == '!') {
      if (cur == 1) {
        res++;
        continue;
      }
      m = x.size() - 1;
      cnt++;
      for (int j = 0; j <= m; ++j) {
        if (!d[x[j]] && p[x[j]] < cnt) p[x[j]]++;
      }
      for (int j = 97; j <= 122; ++j) {
        if (!d[j] && p[j] < cnt) d[j] = 1, cur--;
      }
    }
    if (type == '.') {
      if (cur == 1) continue;
      m = x.size() - 1;
      for (int j = 0; j <= m; ++j) {
        if (!d[x[j]]) cur--, d[x[j]] = 1;
      }
    }
    if (type == '?') {
      if (cur == 1) {
        res++;
        continue;
      }
      if (!d[x[0]]) cur--, d[x[0]] = 1;
    }
  }
  if (res)
    cout << res - 1;
  else
    cout << 0;
}
