#include <cstdio>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_map>
#include <queue>
#define pb push_back
#define sz size()
using namespace std;
typedef vector<int> vi;
int n;
char lastc, nowc;
char getbufchar() {
  lastc = nowc;
  nowc = getchar();
  return nowc;
}
bool getuntil(char c, char stopchar) {
  char a;
  do {
    a = getbufchar();
  } while(a != c && a != stopchar);
  return a == c;
}
struct var {
  bool neg;
  int x;
  void print() const {printf("%cx%d ", neg? '~':' ', x);}
  bool ist(const vector<int>& X) const {
    return (bool)(X[x-1]) != neg;
  }
};
bool ist(const vector<var>& vv, const vector<int>& X) {
  for(const var& v: vv)
    if(v.ist(X)) return true;
  return false;
}
bool ist(const vector<vector<var>>& vvv, const vector<int>& X) {
  for(const vector<var>& vv: vvv)
    if(!ist(vv, X)) return false;
  return true;
}
bool inc(vector<int>& X) {
  for(int i=0; i<X.sz; ++i) {
    ++X[i];
    if(X[i] <= 1) return true;
    X[i] = 0;
    if(i == X.sz-1) return false;
  }
}
vector<var> getparen() {
  vector<var> res;
  if(!getuntil('(', EOF)) return res;
  while(getuntil('x', ')')) {
    bool neg = lastc == '~';
    int x; scanf("%d", &x);
    res.pb({neg, x});
  }
  return res;
}
vector<vector<var>> getinput() {
  vector<vector<var>> input;
  while(true) {
    vector<var> p = getparen();
    if(!p.sz) return input;
    else input.pb(p);
  }
}
int main() {
  scanf("%d", &n);
  vector<vector<var>> input = getinput();
  vector<int> X(n, 0);
  int cnt = 0;
  do {
    if(ist(input, X)) ++cnt;
  } while(inc(X));
  printf("%d\n", cnt);
}
        | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #include <cstdio> #include <algorithm> #include <vector> #include <set> #include <unordered_map> #include <queue> #define pb push_back #define sz size() using namespace std; typedef vector<int> vi; int n; char lastc, nowc; char getbufchar() { lastc = nowc; nowc = getchar(); return nowc; } bool getuntil(char c, char stopchar) { char a; do { a = getbufchar(); } while(a != c && a != stopchar); return a == c; } struct var { bool neg; int x; void print() const {printf("%cx%d ", neg? '~':' ', x);} bool ist(const vector<int>& X) const { return (bool)(X[x-1]) != neg; } }; bool ist(const vector<var>& vv, const vector<int>& X) { for(const var& v: vv) if(v.ist(X)) return true; return false; } bool ist(const vector<vector<var>>& vvv, const vector<int>& X) { for(const vector<var>& vv: vvv) if(!ist(vv, X)) return false; return true; } bool inc(vector<int>& X) { for(int i=0; i<X.sz; ++i) { ++X[i]; if(X[i] <= 1) return true; X[i] = 0; if(i == X.sz-1) return false; } } vector<var> getparen() { vector<var> res; if(!getuntil('(', EOF)) return res; while(getuntil('x', ')')) { bool neg = lastc == '~'; int x; scanf("%d", &x); res.pb({neg, x}); } return res; } vector<vector<var>> getinput() { vector<vector<var>> input; while(true) { vector<var> p = getparen(); if(!p.sz) return input; else input.pb(p); } } int main() { scanf("%d", &n); vector<vector<var>> input = getinput(); vector<int> X(n, 0); int cnt = 0; do { if(ist(input, X)) ++cnt; } while(inc(X)); printf("%d\n", cnt); } | 
 
            
         English
                    English