#include <bits/stdc++.h>

#define debug(...) fprintf(stderr, __VA_ARGS__)

#ifndef AT_HOME
#define getchar() IO::myGetchar()
#define putchar(x) IO::myPutchar(x)
#endif

namespace IO {
	static const int IN_BUF = 1 << 23, OUT_BUF = 1 << 23;

	inline char myGetchar() {
		static char buf[IN_BUF], *ps = buf, *pt = buf;
		if (ps == pt) {
			ps = buf, pt = buf + fread(buf, 1, IN_BUF, stdin);
		}
		return ps == pt ? EOF : *ps++;
	}

	template<typename T>
	inline bool read(T &x) {
		bool op = 0;
		char ch = getchar();
		x = 0;
		for (; !isdigit(ch) && ch != EOF; ch = getchar()) {
			op ^= (ch == '-');
		}
		if (ch == EOF) {
			return false;
		}
		for (; isdigit(ch); ch = getchar()) {
			x = x * 10 + (ch ^ '0');
		}
		if (op) {
			x = -x;
		}
		return true;
	}

	inline int readStr(char *s) {
		int n = 0;
		char ch = getchar();
		for (; isspace(ch) && ch != EOF; ch = getchar())
			;
		for (; !isspace(ch) && ch != EOF; ch = getchar()) {
			s[n++] = ch;
		}
		s[n] = '\0';
		return n;
	}

	inline void myPutchar(char x) {
		static char pbuf[OUT_BUF], *pp = pbuf;
		struct _flusher {
			~_flusher() {
				fwrite(pbuf, 1, pp - pbuf, stdout);
			}
		};
		static _flusher outputFlusher;
		if (pp == pbuf + OUT_BUF) {
			fwrite(pbuf, 1, OUT_BUF, stdout);
			pp = pbuf;
		}
		*pp++ = x;
	}

	template<typename T>
	inline void print_(T x) {
		if (x == 0) {
			putchar('0');
			return;
		}
		static int num[40];
		if (x < 0) {
			putchar('-');
			x = -x;
		}
		for (*num = 0; x; x /= 10) {
			num[++*num] = x % 10;
		}
		while (*num){
			putchar(num[*num] ^ '0');
			--*num;
		}
	}

	template<typename T>
	inline void print(T x, char ch = '\n') {
		print_(x);
		putchar(ch);
	}

	inline void printStr_(const char *s, int n = -1) {
		if (n == -1) {
			n = strlen(s);
		}
		for (int i = 0; i < n; ++i) {
			putchar(s[i]);
		}
	}

	inline void printStr(const char *s, int n = -1, char ch = '\n') {
		printStr_(s, n);
		putchar(ch);
	}
}
using namespace IO;

const int N = 1505, P = 998244353;

int n;
char a[N][N];

struct Graph {
	int n, d[N], fa[N];
	int E[N][N];

	void init(int _n) {
		n = _n;
		for (int i = 0; i < n; ++i) {
			d[i] = 0, fa[i] = i;
		}
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				E[i][j] = -1;
			}
		}
	}

	bool addEdge(int u, int v, int w) {
		if (w == -1) {
			return true;
		}
		if (E[u][v] == -1) {
			E[u][v] = E[v][u] = w;
			return true;
		}
		return E[u][v] == w;
	}

	int find(int x) {
		return fa[x] == x ? x : (fa[x] = find(fa[x]));
	}

	bool merge(int x, int y) {
		x = find(x), y = find(y);
		if (x == y) {
			return false;
		}
		fa[y] = x, d[x] += d[y];
		return true;
	}

	int calc() {
		int m = 0;
		for (int i = 0; i < n; ++i) {
			for (int j = i + 1; j < n; ++j) {
				if (E[i][j] == -1) {
					++m;
				} else {
					d[i] += E[i][j], d[j] += E[i][j];
				}
			}
		}
		if (n & 1) {
			for (int i = 0; i < n; ++i) {
				for (int j = i + 1; j < n; ++j) {
					if (E[i][j] == -1) {
						m -= merge(i, j);
					}
				}
			}
			for (int i = 0; i < n; ++i) {
				if (find(i) == i && d[i] & 1) {
					return 0;
				}
			}
		}
		int ans = 1;
		for (int i = 1; i <= m; ++i) {
			ans = 2 * ans % P;
		}
		return ans;
	}
} G[2];

int main() {
	read(n);
	for (int i = 1; i < n; ++i) {
		readStr(a[i] + 1);
	}
	G[0].init((n + 2) / 2), G[1].init((n + 1) / 2);
	for (int i = 1; i < n; ++i) {
		for (int j = 1; j < n; ++j) {
			int u = std::min(i + j, n - i + n - j);
			int v = std::max(j - i, i - j);
			int w = a[i][j] == 'o' ? 1 : (a[i][j] == 'x' ? 0 : -1);
			if (!G[(i + j) & 1].addEdge(u >> 1, v >> 1, w)) {
				print(0);
				return 0;
			}
		}
	}
	print(1ll * G[0].calc() * G[1].calc() % P);
}


Measured memory_bytes: 16848