#include <bits/stdc++.h>
using namespace std;
template <typename T>
struct outputer;
struct outputable {};
template <typename T>
inline auto sqr(T x) -> decltype(x * x) {
  return x * x;
}
template <typename T1, typename T2>
inline bool umx(T1& a, T2 b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T1, typename T2>
inline bool umn(T1& a, T2 b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
const int N = 100000;
struct Input {
  int n;
  char c[N];
  string s[N];
  bool read() {
    if (!(cin >> n)) {
      return 0;
    }
    for (int i = int(0); i < int(n); ++i) {
      cin >> c[i] >> s[i];
    }
    return 1;
  }
  void init(const Input& input) { *this = input; }
};
struct Data : Input {
  int ans;
  void write() { cout << ans << endl; }
};
namespace Main {
const int C = 26;
struct Solution : Data {
  void solve() {
    int all = (1 << C) - 1;
    int msk = all;
    ans = 0;
    for (int i = int(0); i < int(n - 1); ++i) {
      ;
      ;
      if (__builtin_popcount(msk) == 1) {
        if (c[i] == '!' || c[i] == '?') {
          ans++;
        }
      }
      int cur = 0;
      for (int j = int(0); j < int(((int)(s[i]).size())); ++j) {
        cur |= 1 << (s[i][j] - 'a');
      }
      if (c[i] == '!') {
        msk &= cur;
      } else {
        msk &= all - cur;
      }
    }
  }
  void clear() { *this = Solution(); }
};
}  // namespace Main
Main::Solution sol;
int main() {
  cout.setf(ios::showpoint | ios::fixed);
  cout.precision(20);
  sol.read();
  sol.solve();
  sol.write();
  return 0;
}
