#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
const long long Mod = 1e9 + 7;
int n;
string strs[114];
int nums[114][114];
int len;
int tree[114][2];
int cc;
long long index;
long long res;
void gen () {
memset (tree, 0, sizeof (tree));
cc = 0;
for (int i = 1; i <= n; i++) {
int now = 0;
for (int j = 0; j < strs[i].size(); j++) {
int num;
if (strs[i][j] != '?') {
num = strs[i][j] - '0';
}
else {
num = bool (index & (1 << (nums[i][j] - 1)));
}
if (tree[now][num] == 0) {
cc++;
tree[now][num] = cc;
}
now = tree[now][num];
}
}
}
int main () {
freopen ("lowtea.in", "r", stdin);
freopen ("lowtea.out", "w", stdout);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> strs[i];
for (int j = 0; j < strs[i].size(); j++) {
if (strs[i][j] == '?') {
len++;
nums[i][j] = len;
}
}
}
if (len == 0) {
gen ();
res = cc + 1;
}
else {
for (index = 0; index < (1 << len); index++) {
gen ();
res += cc + 1;
res %= Mod;
}
}
cout << res << endl;
return 0;
}