#include <bits/stdc++.h>
using namespace std;
int vis[26];
int n;
char s[100001];
int cnt[26];
int main() {
  char ch;
  memset(vis, -1, sizeof(vis));
  int tot = 0;
  scanf("%d", &n);
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    scanf(" %c %s", &ch, s);
    int len = strlen(s);
    if (ch == '.') {
      for (int i = 0; i < len; ++i)
        if (vis[s[i] - 'a'] == -1) {
          ++tot;
          vis[s[i] - 'a'] = 1;
        }
    } else if (ch == '!') {
      if (tot == 25) {
        ++ans;
      }
      for (int i = 0; i < len; ++i) cnt[s[i] - 'a'] = true;
      for (int i = 0; i < 26; ++i)
        if (vis[i] == -1 && cnt[i] == 0) {
          vis[i] = 1;
          ++tot;
        }
      for (int i = 0; i < len; ++i) cnt[s[i] - 'a'] = false;
    } else {
      if (i != n - 1) {
        if (tot == 25) {
          ++ans;
        }
        if (vis[s[0] - 'a'] == -1) {
          vis[s[0] - 'a'] = 1;
          ++tot;
        }
      }
    }
  }
  printf("%d\n", ans);
}
