#include <bits/stdc++.h>
using namespace std;
set<int> with;
string s;
set<int> out;
map<char, int> m;
string tt;
string abc = "abcdefghijklmnopqrstuvwxyz";
int main() {
  int n;
  cin >> n;
  char c;
  bool f = 0;
  bool f2 = false;
  int t = 0;
  int count = 0;
  bool flag = 0;
  int w = 0;
  for (int i = 0; i < n - 1; i++) {
    cin >> c;
    cin >> s;
    if (c == '!') {
      for (int j = 0; j < 26; j++) {
        for (int x = 0; x < s.size(); x++)
          if (abc[j] == s[x]) f = true;
        if (!f) abc[j] = 'A';
        f = false;
      }
      if (flag) w++;
    } else if (c == '?') {
      for (int j = 0; j < 26; j++) {
        if (abc[j] == s[0]) abc[j] = 'A';
      }
      if (flag) w++;
    } else {
      for (int x = 0; x < s.size(); x++)
        for (int j = 0; j < 26; j++) {
          if (abc[j] == s[x]) abc[j] = 'A';
        }
    }
    for (int o = 0; o < 26; o++) {
      if (abc[o] != 'A') count++;
    }
    if (count == 1) flag = true;
    count = 0;
  }
  cin >> c >> s;
  cout << w;
  return 0;
}
