#include #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; using lint=long long; template class matrix{ vector> a; public: matrix(int n):a(n,vector(n)){} matrix(int m,int n):a(m,vector(n)){} matrix& operator+=(const matrix& A){ assert(h()==A.h() && w()==A.w()); int m=h(),n=w(); rep(i,m) rep(j,n) (*this)[i][j]+=A[i][j]; return *this; } matrix& operator-=(const matrix& A){ assert(h()==A.h() && w()==A.w()); int m=h(),n=w(); rep(i,m) rep(j,n) (*this)[i][j]-=A[i][j]; return *this; } matrix& operator*=(const matrix& A){ assert(w()==A.h()); int m=h(),n=w(),l=A.w(); matrix B(m,l); rep(i,m) rep(j,l) rep(k,n) B[i][j]+=(*this)[i][k]*A[k][j]; swap(*this,B); return *this; } matrix operator+(const matrix& A)const{ return matrix(*this)+=A; } matrix operator-(const matrix& A)const{ return matrix(*this)-=A; } matrix operator*(const matrix& A)const{ return matrix(*this)*=A; } const vector& operator[](int i)const{ return a[i]; } vector& operator[](int i){ return a[i]; } vector operator*(const vector& v)const{ assert(w()==v.size()); int m=h(),n=w(); vector res(m); rep(i,m) rep(j,n) res[i]+=(*this)[i][j]*v[j]; return res; } int h()const{ return a.size(); } int w()const{ return a.empty()?0:a[0].size(); } static matrix identity(int n){ matrix I(n); rep(i,n) I[i][i]=R{1}; return I; } }; class F2{ bool x; public: F2():x(false){} F2(long long n){ assert(n==0||n==1); x=(n==1); } F2& operator+=(const F2& a){ x=(x!=a.x); return *this; } F2& operator-=(const F2& a){ return (*this)+=a; } F2& operator*=(const F2& a){ x=(x&&a.x); return *this; } F2& operator/=(const F2& a){ assert(a.x); return *this; } F2 operator+(const F2& a)const{ return F2(*this)+=a; } F2 operator-(const F2& a)const{ return F2(*this)-=a; } F2 operator*(const F2& a)const{ return F2(*this)*=a; } F2 operator/(const F2& a)const{ return F2(*this)/=a; } bool operator==(const F2& a)const{ return x==a.x; } bool operator!=(const F2& a)const{ return !((*this)==a); } int to_int()const{ return x; } }; int matrix_rank(matrix A){ int m=A.h(),n=A.w(),r=0; rep(j,n){ int piv; for(piv=r;piv a(n); rep(i,n) scanf("%lld",&a[i]); matrix A(n,60); rep(i,n) rep(j,60) A[i][j]=a[i]>>j&1; printf("%lld\n",1LL<