#include <bits/stdc++.h>
using namespace std;
const long long N = 105;
const long long H = 1e9 + 7;
bool nums[26];
bool temp[26];
bool check() {
  long long i, c = 0;
  for (i = 0; i < 26; i += 1)
    if (nums[i] == true) c++;
  return (c == 1);
}
int main() {
  long long i, j, k, l, m, n, d, c, ans = 0;
  cin >> n;
  string y, s;
  char x;
  memset(nums, true, sizeof(nums));
  while (n) {
    cin >> x >> s;
    if (x == '!') {
      memset(temp, false, sizeof(temp));
      for (i = 0; i < s.length(); i += 1) temp[s[i] - 'a'] = 1;
      for (i = 0; i < 26; i += 1) nums[i] = nums[i] & temp[i];
    }
    if (x == '.') {
      memset(temp, true, sizeof(temp));
      for (i = 0; i < s.length(); i += 1) temp[s[i] - 'a'] = 0;
      for (i = 0; i < 26; i += 1) nums[i] = nums[i] & temp[i];
    }
    if (x == '?')
      if (n != 1) nums[s[0] - 'a'] = 0;
    n -= 1;
    if (check()) break;
  }
  if (n == 0) {
    cout << 0;
    return 0;
  }
  while (n--) {
    cin >> x >> s;
    if (x == '!' || x == '?') ans++;
  }
  cout << ans - 1;
  return 0;
}
