Iahub likes chess very much. He even invented a new chess piece named Coder. A Coder can move (and attack) one square horizontally or vertically. More precisely, if the Coder is located at position (*x*, *y*), he can move to (or attack) positions (*x* + 1, *y*), (*x*–1, *y*), (*x*, *y* + 1) and (*x*, *y*–1).

Iahub wants to know how many Coders can be placed on an *n* × *n* chessboard, so that no Coder attacks any other Coder.
The first line contains an integer *n* (1 ≤ *n* ≤ 1000).
n = int(input())
board = [['.' for j in range(n)] for i in range(n)]
max_count = 0
max_board = None
def is_valid(board, x, y):
    for i in range(n):
        if board[i][y] == 'C' or board[x][i] == 'C':
            return False
    for i, j in [(x+1,y), (x-1,y), (x,y+1), (x,y-1)]:
        if 0 <= i < n and 0 <= j < n and board[i][j] == 'C':
            return False
    return True

def backtrack(board, count):
    global max_count, max_board
    if count > max_count:
        max_count = count
        max_board = [row[:] for row in board]
    for i in range(n):
        for j in range(n):
            if board[i][j] == '.' and is_valid(board, i, j):
                board[i][j] = 'C'
                backtrack(board, count+1)
                board[i][j] = '.'

backtrack(board, 0)
print(max_count)
for row in max_board:
    print(''.join(row))
