#include using namespace std; using Int = long long; template inline void chmin(T1 &a,T2 b){if(a>b) a=b;} template inline void chmax(T1 &a,T2 b){if(a vector compress(vector v){ sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); return v; } template map dict(const vector &v){ map res; for(Int i=0;i<(Int)v.size();i++) res[v[i]]=i; return res; } //INSERT ABOVE HERE signed main(){ Int n; cin>>n; vector s(n); for(Int i=0;i>s[i]; Int ans=n+1; vector cnt(n,0); function dfs= [&](Int y,Int x){ if(y==n){ chmin(ans,n-dict(compress(cnt))[cnt[0]]); return; } Int nx=(x+1)%n,ny=y+!nx; if(x<=y) dfs(ny,nx); if(s[y][x]!='x'){ cnt[y]++; dfs(ny,nx); cnt[y]--; } if(s[y][x]!='o'){ cnt[x]++; dfs(ny,nx); cnt[x]--; } }; dfs(0,0); cout<