#include <bits/stdc++.h>
using namespace std;
int n;
int cnt = 26, ans = 0;
bool vis[26], cur[26], flag = false;
char s1[26], s2[100010];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < 26; ++i) vis[i] = true;
  flag = false;
  cnt = 26;
  ans = 0;
  for (int i = 1; i <= n; ++i) {
    scanf("%s%s", s1, s2);
    if (s1[0] == '!') {
      if (cnt == 1) {
        ans++;
        continue;
      }
      for (int j = 0; j < 26; ++j) cur[j] = false;
      int len = strlen(s2);
      for (int j = 0; j < len; ++j) cur[s2[j] - 'a'] = true;
      for (int j = 0; j < 26; ++j) {
        if (!cur[j] && vis[j]) vis[j] = false, cnt--;
      }
    }
    if (s1[0] == '.') {
      for (int j = 0; j < 26; ++j) cur[j] = false;
      int len = strlen(s2);
      for (int j = 0; j < len; ++j) cur[s2[j] - 'a'] = true;
      for (int j = 0; j < 26; ++j) {
        if (cur[j] && vis[j]) {
          vis[j] = false, cnt--;
        }
      }
    }
    if (s1[0] == '?') {
      if (i == n) continue;
      if (cnt == 1)
        ans++;
      else if (vis[s2[0] - 'a'])
        cnt--, vis[s2[0] - 'a'] = false;
    }
  }
  printf("%d\n", ans);
  return 0;
}
