#include <bits/stdc++.h>
using namespace std;
const int maxs = 1e5 + 10;
bool poss[26], app[26];
char cmd[2], s[maxs];
int cnt = 26, n, ans;
int main() {
  memset(poss, true, sizeof(poss));
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    memset(app, false, sizeof(app));
    scanf("%s", cmd);
    if (cmd[0] == '.') {
      scanf("%s", s);
      int len = strlen(s);
      for (int j = 0; j < len; j++) {
        app[s[j] - 'a'] = true;
      }
      for (int j = 0; j < 26; j++)
        if (app[j] && poss[j]) {
          poss[j] = false;
          --cnt;
        }
    } else if (cmd[0] == '!') {
      scanf("%s", s);
      int len = strlen(s);
      for (int j = 0; j < len; j++) {
        app[s[j] - 'a'] = true;
      }
      if (cnt == 1) ans++;
      for (int j = 0; j < 26; j++)
        if (!app[j] && poss[j]) {
          poss[j] = false;
          --cnt;
        }
    } else {
      char guess[2];
      scanf("%s", guess);
      if (i != n - 1 && cnt == 1) ans++;
      if (poss[guess[0] - 'a']) {
        poss[guess[0] - 'a'] = false;
        --cnt;
      }
    }
  }
  printf("%d\n", ans);
}
