from itertools import product def main(): l = int(input()) n = int(input()) dnas = set() for s in input().split(): k = set(["".join(x) + s for x in product("AB", repeat=l - len(s))]) dnas.update(k) print(len(dnas)) if __name__ == '__main__': main()