#include <bits/stdc++.h>
using namespace std;
long long Power(long long a, long long b) {
  if (b == 0) return 1;
  long long p = Power(a, b / 2);
  p = (p * p);
  if (b & 1) {
    p = (p * a);
  }
  return p;
}
long long Gcd(long long a, long long b) {
  if (b == 0) return a;
  if (a < b) return Gcd(b, a);
  return Gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int shocks = 0;
  int ans = 0;
  bool b = 0;
  vector<int> arr(26, 1), temp(26);
  int poss = 26;
  for (int i = 0; i < n - 1; i++) {
    string s1, s2;
    cin >> s1 >> s2;
    if (s1[0] == '.') {
      int l = s2.length();
      for (int j = 0; j < l; j++) {
        if (arr[s2[j] - 'a'] == 1) {
          arr[s2[j] - 'a'] = 0;
          poss--;
        }
      }
    } else if (s1[0] == '!') {
      shocks++;
      if (!b) ans++;
      int l = s2.length();
      for (int j = 0; j < 26; j++) temp[j] = 0;
      for (int j = 0; j < l; j++) {
        temp[s2[j] - 'a'] = 1;
      }
      for (int j = 0; j < 26; j++) {
        if ((temp[j] & arr[j]) != 1 && arr[j] == 1) {
          arr[j] = 0;
          poss--;
        }
      }
    } else {
      shocks++;
      if (!b) ans++;
      if (arr[s2[0] - 'a'] != 0) {
        arr[s2[0] - 'a'] = 0;
        poss--;
      }
    }
    if (poss == 1) {
      b = 1;
    }
  }
  string s3, s4;
  cin >> s3 >> s4;
  cout << shocks - ans;
  return 0;
}
