#include <bits/stdc++.h>
const int MAXN = 1e5 + 5;
const int MOD = 1e9 + 7;
using namespace std;
int main() {
  int n;
  cin >> n;
  bool a[26];
  for (int i = 0; i < 26; i++) a[i] = 1;
  int unnecessary = 0;
  for (int q = 0; q < n; q++) {
    char type;
    cin >> type;
    if (type == '!') {
      int suspect = 0;
      for (int i = 0; i < 26; i++)
        if (a[i]) suspect++;
      if (suspect == 1) unnecessary++;
      string s;
      cin >> s;
      bool tempset[26];
      for (int i = 0; i < 26; i++) tempset[i] = 0;
      for (int i = 0; i < s.length(); i++) tempset[s[i] - 'a'] = 1;
      for (int i = 0; i < 26; i++)
        if (a[i] && tempset[i]) {
          a[i] = 1;
        } else {
          a[i] = 0;
        }
    } else if (type == '.') {
      string s;
      cin >> s;
      for (int i = 0; i < s.length(); i++) a[s[i] - 'a'] = 0;
    } else if (type == '?') {
      char c;
      cin >> c;
      int suspect = 0;
      for (int i = 0; i < 26; i++)
        if (a[i]) suspect++;
      if (suspect == 1 && q < n - 1) unnecessary++;
      a[c - 'a'] = 0;
    }
  }
  cout << unnecessary << endl;
}
