#include <bits/stdc++.h>
using namespace std;
const int N = 1E5 + 5;
int n, tot, len, x, ans;
bool o[30], o2[30];
char s[N], ch[2];
void del(int x) {
  if (!o[x]) tot--;
  o[x] = 1;
}
int main() {
  cin >> n;
  tot = 26;
  for (int i = 1; i <= n; i++) {
    scanf("%s %s", ch, s);
    len = strlen(s);
    memset(o2, 0, sizeof(o2));
    if (tot == 1 && ch[0] != '.') ans++;
    if (i == n && tot != 1) ans = 1;
    for (int j = 0; j < len; j++) {
      x = s[j] - 'a';
      if (ch[0] == '?' || ch[0] == '.')
        del(x);
      else
        o2[x] = 1;
    }
    if (ch[0] == '!')
      for (int j = 0; j < 26; j++)
        if (!o2[j]) del(j);
  }
  cout << ans - 1;
}
