#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
char s[maxn];
char sign[5];
bool ok[26];
bool tmp[26];
int main() {
  int n;
  scanf("%d", &n);
  memset(ok, 1, sizeof ok);
  int ans = 0;
  int cnt = 0;
  for (int i = 1; i < n; i++) {
    memset(tmp, 0, sizeof tmp);
    scanf("%s %s", sign, s);
    int l = strlen(s);
    if (sign[0] == '.') {
      for (int j = 0; j < l; j++) {
        int num = s[j] - 'a';
        ok[num] = false;
      }
    }
    if (sign[0] == '!') {
      for (int j = 0; j < l; j++) {
        int num = s[j] - 'a';
        tmp[num] = true;
      }
      for (int j = 0; j < 26; j++) {
        ok[j] &= tmp[j];
      }
    }
    if (sign[0] == '?') {
      int num = s[0] - 'a';
      ok[num] = false;
    }
    if (cnt == 1 && sign[0] != '.') ans++;
    cnt = 0;
    for (int j = 0; j < 26; j++) cnt += ok[j];
  }
  cout << ans << endl;
  return 0;
}
