import sequtils,strutils,math const Mo : int64 = 1_000_000_007 var N = stdin.readline.parseInt s : string S = newSeq[string](0) dp : array[1100_000, int64] P : array[21,int64] ans : array[21, int64] cnts : array[21, int64] lcm : array[21, array[21,int64]] P[0] = 1 for i in 1..20: P[i] = P[i - 1] * i for n in 1..N: s = stdin.readline & " " S.add(s) for i,s1 in S: for j,s2 in S: if i == j: continue for k in 0..min(s1.high,s2.high): if s1[k] != s2[k]: lcm[i][j] = k + 1 lcm[j][i] = k + 1 break for i in 0..<(1 shl N): #echo i, " ",countBits32(i.int32), " ",dp[i] var bc = countBits32(i.int32) ans[bc] = (ans[bc] + dp[i]) mod Mo for k in 0..