#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, 1, -1, 1, -1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void PLAY() {
  cout << fixed << setprecision(10);
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int tmp[100];
int tmpa[100];
int main() {
  PLAY();
  int n;
  cin >> n;
  int res = 0;
  int cur = 26;
  char type;
  string s;
  for (int i = 0; i < n - 1; i++) {
    cin >> type >> s;
    if (cur <= 1) {
      res += (type == '?' ? tmp[s[0] - 'a'] == -1 : type == '!');
      continue;
    }
    if (type == '.') {
      for (auto e : s)
        if (tmp[e - 'a'] != -1) tmp[e - 'a'] = -1, cur--;
    } else if (type == '?') {
      if (tmp[s[0] - 'a'] != -1) tmp[s[0] - 'a'] = -1, cur--;
    } else {
      memset(tmpa, 0, sizeof tmpa);
      for (auto e : s) tmpa[e - 'a'] = 1;
      for (char a = 'a'; a <= 'z'; a++) {
        if (tmp[a - 'a'] != -1 && tmpa[a - 'a'] == 0) tmp[a - 'a'] = -1, cur--;
      }
    }
  }
  cout << res << endl;
  return 0;
}
