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).
import sys
import math
import bisect
import heapq
import string
from collections import defaultdict,Counter,deque
 
def I():
    return input()
 
def II():
    return int(input())
 
def MII():
    return map(int, input().split())
 
def LI():
    return list(input().split())
 
def LII():
    return list(map(int, input().split()))
 
def GMI():
    return map(lambda x: int(x) - 1, input().split())
 
def LGMI():
    return list(map(lambda x: int(x) - 1, input().split()))
 
def WRITE(out):
  return print('\n'.join(map(str, out)))
 
def WNS(out):
  return print(' '.join(map(str, out)))
 
def WNS(out):
  return print(''.join(map(str, out)))

'''
AB
AABB
ABAB

BBAA X
AABBA

010101

x+y = n
x = n - y
x*y vs (n-y)^2

0  = 1
1  = 1
01 = max(1*1) = 1
10 = 1
00 = 4
11 = 4
11110 = 16

compare biggest group of 1's 0's and num1's * num0's

5 -1 -2
'''

# sys.stdin = open("backforth.in", "r")
# sys.stdout = open("backforth.out", "w")
input = sys.stdin.readline

def dist(c1, c2):
  return abs(c1[0] - c2[0]) + abs(c1[1] - c2[1])

def solve():
  n = II()
  ans = 0

  if n & 1:
    for i in range(1,n,2):
      ans += i*2
    ans += n
  else:
    for i in range(2,n,2):
      ans += i*2
    ans += n

  board = []
  odd = ['C' if i%2 == 0 else '.' for i in range(n)]
  even = ['C' if i&1 else '.' for i in range(n)]



  print(ans)
  for i in range(1,n+1):
    if i&1:
      WNS(odd)
    else:
      WNS(even)



solve()