from itertools import product, zip_longest

def grouper(iterable, n, fillvalue=None):
    "Collect data into fixed-length chunks or blocks"
    # grouper('ABCDEFG', 3, 'x') --> ABC DEF Gxx"
    return zip_longest(*[iter(iterable)] * n, fillvalue=fillvalue)

def print_board(B, cols):
    for row in grouper(B, cols): print(list(row))

board_set = [ b for b in product([ 0, 1 ],repeat=4*4) if b.count(1) == 14 ]

for b in board_set:
    print_board(b, 4)
    print()
    
print(len(board_set))