#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
bool val[26];
bool con[26];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  string s, t;
  cin >> N;
  int res = 0;
  bool f = false;
  fill(val, val + 26, 1);
  for (int i = 0; i < N; i++) {
    cin >> t >> s;
    fill(con, con + 26, 0);
    for (int j = 0; j < (int)s.size(); j++) con[s[j] - 'a'] = true;
    if (t == "!") {
      for (int j = 0; j < 26; j++) val[j] = val[j] && con[j];
    } else {
      for (int j = 0; j < 26; j++) val[j] = val[j] && !con[j];
    }
    res += f && (t == "!" || t == "?");
    int cnt = 0;
    for (int j = 0; j < 26; j++) cnt += val[j];
    f |= cnt <= 1;
  }
  cout << max(0, res - 1) << '\n';
  return 0;
}
