#include <bits/stdc++.h>
using namespace std;
int check(long long x) {
  int ans = 0;
  for (; x > 0; x -= (x & -x)) {
    ans++;
  }
  return ans;
}
int main() {
  long long state = (1 << 26) - 1;
  int n;
  cin >> n;
  int counter = 0;
  for (int i = 0; i < n; i++) {
    char c;
    string s;
    cin >> c >> s;
    set<char> wew;
    int size = s.size();
    long long r;
    if (c == '!') {
      r = 0;
      for (int j = 0; j < size; j++) {
        if (wew.find(s[j]) == wew.end()) {
          r += (1 << (s[j] - 'a' + 0));
          wew.insert(s[j]);
        }
      }
      state &= r;
    }
    if (c == '.' || c == '?') {
      r = (1 << 26) - 1;
      for (int j = 0; j < size; j++) {
        if (wew.find(s[j]) == wew.end()) {
          r -= (1 << (s[j] - 'a' + 0));
          wew.insert(s[j]);
        }
      }
      state &= r;
    }
    counter++;
    if (check(state) == 1) {
      int shock = 0;
      for (int j = 0; j < n - counter; j++) {
        char C;
        string S;
        cin >> C >> S;
        if (C == '!' || C == '?') shock++;
      }
      cout << --shock << "\n";
      return 0;
    }
  }
  cout << 0 << "\n";
}
