#include <bits/stdc++.h>
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
bool a[1123];
int n;
string s;
int main() {
  ios_base::sync_with_stdio(0);
  int i, j;
  for (i = (int)'a'; i <= (int)'z'; i++) a[i] = true;
  cin >> n;
  char c, w;
  bool flag = false;
  int ans = 0;
  for (i = 0; i < n - 1; i++) {
    cin >> c;
    if (c == '.') {
      cin >> s;
      for (j = 0; j < s.length(); j++) a[(int)s[j]] = false;
    }
    if (c == '?') {
      cin >> w;
      if (flag) {
        ans++;
        continue;
      }
      a[(int)w] = false;
    }
    if (c == '!') {
      cin >> s;
      if (flag) {
        ans++;
        continue;
      }
      for (int k = (int)'a'; k <= (int)'z'; k++) {
        bool f = false;
        for (j = 0; j < s.length(); j++)
          if ((int)s[j] == k) f = true;
        if (!f) a[k] = false;
      }
    }
    int cnt = 0;
    for (int k = (int)'a'; k <= (int)'z'; k++)
      if (a[k] == true) cnt++;
    if (cnt == 1) flag = true;
  }
  cin >> c >> w;
  cout << ans;
  return 0;
}
