#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const int N = 1e5 + 5;
int m[3];
bool al[26];
int main() {
  int n, cnt = 0, ans = 0;
  cin >> n;
  bool f = false;
  for (int i = 1; i <= n; i++) {
    char t;
    cin >> t;
    string p;
    cin >> p;
    if (cnt == 25) f = true;
    if (t == '.') {
      for (int j = 0; j < p.size(); j++)
        if (al[p[j] - 'a'] == 0) al[p[j] - 'a'] = true, cnt++;
    } else if (t == '?' && i != n) {
      if (f) ans++;
      if (al[p[0] - 'a'] == 0) al[p[0] - 'a'] = true, cnt++;
    } else if (t == '!') {
      if (f) ans++;
      vector<int> v;
      for (int j = 0; j < p.size(); j++) {
        if (al[p[j] - 'a'] == 0) v.push_back(p[j] - 'a');
      }
      for (int j = 0; j < 26; j++) al[j] = 1;
      cnt = 26;
      for (int j = 0; j < v.size(); j++) {
        cnt -= al[v[j]];
        al[v[j]] = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
