#include <bits/stdc++.h>   using namespace std;   bool notis[30] = {false}, mayis[30] = {false};   string str;   int main() {     int n, flag = 0, cnt = 0, tem, i, j;     char p;     std::ios::sync_with_stdio(false);     cin >> n;     for (i = 0; i < n; i++) {       cin >> p >> str;       if (flag && (p ==  !  || p ==  ? ))         cnt++;       else {         tem = str.length();         if (p ==  ! ) {           for (j = 0; j < tem; j++) mayis[str[j] -  a ] = true;           for (j = 0; j < 26; j++) {             if (!mayis[j]) notis[j] = true;             mayis[j] = false;           }         } else           for (j = 0; j < tem; j++) notis[str[j] -  a ] = true;         for (tem = j = 0; j < 26; j++)           if (!notis[j]) tem++;         if (tem == 1) flag = 1;       }     }     printf( %d , cnt > 0 ? (cnt - 1) : 0);   }   