#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long x = (1 << 26) - 1;
  int ans = 0;
  while (--n) {
    char c;
    cin >> c;
    string s;
    cin >> s;
    long long y = 0;
    for (int i = 0; s[i]; ++i) {
      y |= 1 << (s[i] - 'a');
    }
    if (c == '!') {
      ans += (__builtin_popcount(x) == 1);
      x &= y;
    } else if (c == '.') {
      x &= y ^ ((1 << 26) - 1);
    } else {
      ans += (__builtin_popcount(x) == 1);
      x &= ~(1 << (s[0] - 'a'));
    }
  }
  cout << ans;
}
