P3857
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define rg register
#define ld long double
#define ull unsigned long long
#define gc getchar
#define pc putchar
#define ppb pop_back
#define umap unordered_map
#define vi vector<int>
#define vl vector<ll>
#define rp(i,r,l) for(rg int i=(r);i>=(l);--i)
#define fo(i,l,r) for(rg int i=(l);i<=(r);++i)
using namespace std;
inline int re() {
rg int x=0,p=0;rg char c=getchar();
while(c<'0'||c>'9') (!p)?(p=c=='-'):(p=p),c=getchar();
while('0'<=c&&c<='9') (x*=10)+=c-48,c=getchar();
if(p) x=-x;
return x;
}
inline ll rel() {
rg ll x=0;rg int p=0;rg char c=getchar();
while(c<'0'||c>'9') (!p)?(p=c=='-'):(p=p),c=getchar();
while('0'<=c&&c<='9') (x*=10)+=c-48,c=getchar();
if(p) x=-x;
return x;
}
inline void wt(rg int x) { if(x<0) pc('-'),x=-x;if(x>9) wt(x/10);pc(x%10+48); }
inline void wtl(rg ll x) { if(x<0) pc('-'),x=-x;if(x>9) wtl(x/10);pc(x%10+48); }
const int N=55;
const int w=50;
int n,m;
struct xxj {
ll a[N];
void insert(ll x) {
rp(i,w,0) {
if(x&(1ll<<i)) {
if(!a[i]) {
a[i]=x;
return;
}
x^=a[i];
}
}
}
int count() {
int ret=0;
fo(i,0,w) {
if(a[i]) ret++;
}
return ret;
}
}t;
char s[N];
int main() {
// freopen("","r",stdin);
// freopen("","w",stdout);
n=re(),m=re();
fo(i,1,m) {
scanf("%s",s+1);
ll x=0;
fo(j,1,n) {
x=(x<<1)|(s[j]=='O');
}
t.insert(x);
}
wtl((1ll<<t.count())%2008);
}