#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx")
const int N = (int)5e5 + 7, inf = (int)1e9 + 7, mod = (int)1e9 + 7;
const long long linf = (long long)1e18 + 7;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1},
          dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
using namespace std;
int n;
set<int> st, bad;
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i <= 25; i++) {
    st.insert(i);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    char type;
    cin >> type;
    if (type == '!') {
      bool ok[26];
      memset(ok, 0, sizeof(ok));
      string second;
      cin >> second;
      for (char j : second) ok[j - 'a'] = 1;
      if ((int)st.size() == 1) {
        if (ok[*st.begin()]) ans++;
      } else {
        for (int j = 0; j <= 25; j++) {
          if (!ok[j]) st.erase(j);
        }
      }
    } else if (type == '.') {
      string second;
      cin >> second;
      for (char j : second) st.erase(j - 'a'), bad.insert(j);
    } else {
      char c;
      cin >> c;
      if ((int)st.size() == 1 && *st.begin() != c - 'a') ans++;
      if (i != n) st.erase(c - 'a');
    }
  }
  cout << ans;
  exit(0);
}
