#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int mod = 1000000007;
const double pi = acos(-1.0);
inline void gn(long long& x) {
  int sg = 1;
  char c;
  while (((c = getchar()) < '0' || c > '9') && c != '-')
    ;
  c == '-' ? (sg = -1, x = 0) : (x = c - '0');
  while ((c = getchar()) >= '0' && c <= '9') x = x * 10 + c - '0';
  x *= sg;
}
inline void gn(int& x) {
  long long t;
  gn(t);
  x = t;
}
inline void gn(unsigned long long& x) {
  long long t;
  gn(t);
  x = t;
}
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long powmod(long long a, long long x, long long mod) {
  long long t = 1ll;
  while (x) {
    if (x & 1) t = t * a % mod;
    a = a * a % mod;
    x >>= 1;
  }
  return t;
}
const int maxn = 1e5 + 9;
char lst;
set<char> ans;
string ori[maxn];
char mode0[maxn];
set<char> tmp;
vector<char> tt;
int main() {
  int n;
  for (char i = 'a'; i <= 'z'; ++i) ans.insert(i);
  gn(n);
  char ch;
  int num = 0;
  for (int i = (1); i <= (n); i++) cin >> mode0[i] >> ori[i];
  lst = ori[n][0];
  for (int i = (1); i <= (n); i++) {
    ch = mode0[i];
    string& a = ori[i];
    if (ch == '?') {
      if (ans.size() == 1 && a[0] != *ans.begin()) num++;
      if (a[0] != lst && ans.count(a[0])) ans.erase(a[0]);
    } else if (ch == '!') {
      tmp.clear();
      tt.clear();
      if (ans.size() == 1) num++;
      for (auto it : a) tmp.insert(it);
      for (auto it : ans) tt.push_back(it);
      for (auto it : tt)
        if (!tmp.count(it)) ans.erase(it);
    } else {
      tmp.clear();
      tt.clear();
      for (auto it : a) tmp.insert(it);
      for (auto it : ans) tt.push_back(it);
      for (auto it : tt) {
        if (tmp.count(it)) ans.erase(it);
      }
    }
  }
  cout << num << endl;
  return 0;
}
