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.


-----Input-----

The first line contains an integer n (1 ≤ n ≤ 1000).


-----Output-----

On the first line print an integer, the maximum number of Coders that can be placed on the chessboard.

On each of the next n lines print n characters, describing the configuration of the Coders. For an empty cell print an '.', and for a Coder print a 'C'.

If there are multiple correct answers, you can print any.


-----Examples-----
Input
2

Output
2
C.
.C

Source: codeforces | Difficulty: EASY
Tags: Implementation


Solutions:
n = int(input())
print(n % 2 + n * n // 2)
for i in range(n):
	if i % 2:
		print(''.join(('C' if j % 2 else '.' for j in range(n))))
	else:
		print(''.join(('.' if j % 2 else 'C' for j in range(n))))


import math

def print_board(n):
	if n % 2 == 0:
		print(n * n // 2)
	else:
		print(math.ceil(n * n / 2))
	for i in range(n):
		for j in range(n):
			if i % 2 == 0:
				if j % 2 == 0:
					print('C', end='')
				else:
					print('.', end='')
			elif j % 2 == 0:
				print('.', end='')
			else:
				print('C', end='')
		print()
n = int(input())
print_board(n)


n = int(input())
print((n * n + 1) // 2)
if n == 1:
	print('C')
else:
	c = 'C.'
	e = '.C'
	c = c * (n // 2) + 'C' * int(n % 2 == 1)
	e = e * (n // 2) + '.' * int(n % 2 == 1)
	for i in range(n):
		if i % 2 == 0:
			print(c)
		else:
			print(e)


k = 0
c = 0
s = ''
ss = ''
n = int(input())
for i in range(n):
	if k % 2 == 0:
		s += 'C'
		ss += '.'
	else:
		s += '.'
		ss += 'C'
	k += 1
k = 0
for i in range(n):
	if k % 2 == 0:
		c += s.count('C')
	else:
		c += ss.count('C')
	k += 1
k = 0
print(c)
for i in range(n):
	if k % 2 == 0:
		print(s)
	else:
		print(ss)
	k += 1


def int_lst_input():
	return [int(val) for val in input().split()]

def int_input():
	return int(input())

def print_lst(lst):
	print(' '.join([str(val) for val in lst]))

def solve():
	n = int_input()
	grid = []
	even = ''.join(['C' if i % 2 == 0 else '.' for i in range(n)])
	odd = ''.join(['C' if i % 2 == 1 else '.' for i in range(n)])
	c_even_count = sum([1 if c == 'C' else 0 for c in even])
	c_odd_count = sum([1 if c == 'C' else 0 for c in odd])
	c = c_even_count * (n // 2 + n % 2) + c_odd_count * (n // 2)
	for i in range(n):
		if i % 2 == 0:
			grid.append(even)
		else:
			grid.append(odd)
	print(c)
	for row in grid:
		print(row)
solve()


(n, l) = (int(input()), list())
if n % 2:
	print(n ** 2 // 2 + 1)
	for i in range(n // 2 + 1):
		l.append([('C.' * (n // 2 + 1))[:n]])
		if i != n // 2:
			l.append([('.C' * (n // 2 + 1))[:n]])
else:
	print(n ** 2 // 2)
	for i in range(0, n, 2):
		l.append(['C.' * (n // 2)])
		l.append(['.C' * (n // 2)])
for i in l:
	print(*i)


def main():
	lst = ['.' for x in range(0, 500)]
	s = 'C'.join(lst) + 'C'
	lst = ['C' for x in range(0, 500)]
	s_ = '.'.join(lst) + '.'
	n = int(input())
	if n * n % 2 == 0:
		print(n * n // 2)
	else:
		print(n * n // 2 + 1)
	cs = s[:n]
	cs_ = s_[:n]
	flag = True
	for i in range(n):
		if flag:
			print(cs_)
			flag = False
		else:
			print(cs)
			flag = True
main()


n = int(input())
print((n ** 2 + 1) // 2)
for x in range(n):
	a = list('.' * n)
	if x % 2 == 0:
		for y in range((n + 1) // 2):
			a[2 * y] = 'C'
	else:
		for y in range(n // 2):
			a[2 * y + 1] = 'C'
	print(''.join(a))


n = int(input())
print((n // 2 + n % 2) ** 2 + (n - (n // 2 + n % 2)) * (n // 2))
c = ''
d = ''
p = 1
for i in range(n):
	c += ('C', '.')[p < 0]
	d += ('C', '.')[p > 0]
	p *= -1
p = 1
for i in range(n):
	print((c, d)[p < 0])
	p *= -1


n = int(input())
k = 1
k1 = n // 2
k2 = n - k1
print(k1 * k1 + k2 * k2)
for x in range(1, n + 1):
	if n % 2 == 0:
		if x % 2 != 0:
			print('C.' * k1)
		else:
			print('.C' * k2)
	else:
		p = n - 2 * (n // 2)
		if x % 2 != 0:
			print('C.' * (n // 2), end='')
			print('C.'[:p] * p, end='')
			print('.' * (p - 2))
		else:
			print('.C' * (n // 2), end='')
			print('.C'[:p] * p, end='')
			print('.' * (p - 2))


x = int(input())
z = (x - 1) / 2 + 1
c = (x - 1) / 2
if x % 2 == 0:
	print(int(x / 2 * x))
else:
	print(int(c ** 2 + z ** 2))
for i in range(1, x + 1):
	if x % 2 == 0:
		if i % 2 == 0:
			print('.C' * int(x / 2))
		elif i % 2 == 1:
			print('C.' * int(x / 2))
	elif x % 2 == 1:
		if i % 2 == 0:
			print('.C' * int((x - 1) / 2) + '.')
		elif i % 2 == 1:
			print('C.' * int((x - 1) / 2) + 'C')


n = int(input())
print(-(-n * n // 2))
for i in range(n):
	print((n * 'C.')[i % 2:n + i % 2])


n = int(input())
if n % 2 == 1:
	print((n + 1) // 2 * n - n // 2)
	for j in range(1, n + 1):
		if j % 2 == 1:
			for i in range((n - 1) // 2):
				print('C.', end='')
			print('C')
		else:
			for i in range((n - 1) // 2):
				print('.C', end='')
			print('.')
else:
	print(n // 2 * n)
	for j in range(1, n + 1):
		if j % 2 == 1:
			for i in range(n // 2):
				print('C.', end='')
			print()
		else:
			for i in range(n // 2):
				print('.C', end='')
			print()


n = int(input().strip())
if n % 2 == 0:
	print(n * n // 2)
else:
	print((n ** 2 + 1) // 2)
for i in range(n):
	row = ''
	for j in range(n):
		if (i + j) % 2 == 0:
			row += 'C'
		else:
			row += '.'
	print(row)


n = int(input())
if n % 2 == 0:
	print(n ** 2 // 2)
	for _ in range(n // 2):
		print('C.' * (n // 2))
		print('.C' * (n // 2))
else:
	print((n // 2 + 1) ** 2 + (n // 2) ** 2)
	for _ in range(n // 2):
		print('C.' * (n // 2) + 'C')
		print('.C' * (n // 2) + '.')
	print('C.' * (n // 2) + 'C')


__author__ = 'Dilshod'
n = int(input())
if not n % 2:
	print(n * (n // 2))
else:
	print((n // 2 + 1) ** 2 + (n // 2) ** 2)
a = True
if n % 2:
	for i in range(n):
		ans = ''
		if a:
			ans += 'C.' * (n // 2) + 'C'
			a = False
		else:
			ans += '.C' * (n // 2) + '.'
			a = True
		print(ans)
else:
	for i in range(n):
		ans = ''
		if a:
			ans += 'C.' * (n // 2)
			a = False
		else:
			ans += '.C' * (n // 2)
			a = True
		print(ans)


n = int(input())
board = [''.join(('C' if i + j & 1 == 0 else '.' for j in range(n))) for i in range(n)]
print(sum((x.count('C') for x in board)))
print('\n'.join(board))


import sys
import math
import bisect

def main():
	n = int(input())
	A = [0] * 2
	for i in range(n):
		for j in range(n):
			val = (i + j) % 2
			A[val] += 1
	print(max(A))
	if A[0] >= A[1]:
		for i in range(n):
			B = ['.'] * n
			for j in range(n):
				if (i + j) % 2 == 0:
					B[j] = 'C'
			print(''.join(B))
	else:
		for i in range(n):
			B = ['.'] * n
			for j in range(n):
				if (i + j) % 2 == 1:
					B[j] = 'C'
			print(''.join(B))
main()


s = ''
for i in range(501):
	s = s + 'C.'
n = int(input())
if n % 2 == 0:
	print(int(n / 2) * n)
else:
	print((n + 1) // 2 * (n + 1) // 2 + n // 2 * (n // 2))
a = s[:n]
b = s[1:n + 1]
flag = 0
for i in range(n):
	if flag == 0:
		print(a)
		flag = 1
	elif flag == 1:
		print(b)
		flag = 0


n = int(input())
count = 0
a = [[0 for _ in range(n)] for _ in range(n)]
print((n * n + 1) // 2)
for i in range(n):
	for j in range(n):
		if i == 2:
			break
		if i == 0:
			if j == 0 or j % 2 == 0:
				a[i][j] = 'C'
			else:
				a[i][j] = '.'
		elif i == 1:
			if a[i - 1][j] != 'C':
				a[i][j] = 'C'
			else:
				a[i][j] = '.'
for i in range(n):
	if i % 2 != 0:
		print(''.join(a[1]))
	else:
		print(''.join(a[0]))


x = int(input())
temp = ''
for i in range(1, x + 1):
	if i % 2 != 0:
		temp += 'C.' * (x // 2) + 'C' * (x & 1)
	else:
		temp += '.C' * (x // 2) + '.' * (x & 1)
	temp += '\n'
print(temp.count('C'))
print(temp)


import math, fractions
n = int(input())
s = 'C.' * pow(n, 2)
if n % 2 == 0:
	print(n * (n // 2))
else:
	print(n * (n + 1) // 2 - n // 2)
for i in range(n):
	if i % 2 == 0:
		print(s[:n])
	else:
		print(s[1:n + 1])


import math
n = int(input())
coders = math.ceil(n * n / 2)
shift = 0
toggle = True
line = ''
print(coders)
for i in range(n):
	if not shift:
		for j in range(n):
			if toggle:
				line = line + 'C'
				toggle = False
			else:
				line = line + '.'
				toggle = True
	else:
		for j in range(n):
			if not toggle:
				line = line + 'C'
				toggle = True
			else:
				line = line + '.'
				toggle = False
	print(line)
	line = ''
	shift = (shift + 1) % 2
	toggle = True


n = int(input())
c = ['.', 'C']
print((n ** 2 + 1) // 2)
for i in range(n):
	if i % 2 != 0:
		print(''.join((c[x % 2] for x in range(n))))
	else:
		print(''.join((c[x % 2 - 1] for x in range(n))))


n = int(input())
a = []
a = [[0] * n for i in range(n)]
for i in range(len(a)):
	for j in range(len(a[i])):
		if i % 2 == 0:
			if j % 2 == 0:
				a[i][j] = 'C'
			else:
				a[i][j] = '.'
		elif j % 2 != 0:
			a[i][j] = 'C'
		else:
			a[i][j] = '.'
count = 0
for z in a:
	for u in z:
		if u == 'C':
			count += 1
print(count)
for e in a:
	print(''.join(map(str, e)))


n = int(input())
s = 'C.' * 500
p = '.C' * 500
if n % 2 == 0:
	print(n * (n // 2))
else:
	print((n - 1) * (n - 1) // 2 + n)
for i in range(n):
	if i % 2 == 0:
		print(s[:n])
	else:
		print(p[:n])


n = int(input())
x = 'C.'
y = '.C'
c = n // 2
ans = 2 * c * c
if n % 2 == 0:
	print(ans)
else:
	ans += n
	print(ans)
for i in range(0, n):
	for j in range(0, n):
		if i % 2 == 0:
			print(x[j % 2], end='')
		else:
			print(y[j % 2], end='')
	print()


def main():
	n = int(input())
	board = [['.'] * n for _ in range(n)]
	ct = 0
	for i in range(0, n, 1):
		for j in range(i % 2, n, 2):
			board[i][j] = 'C'
			ct += 1
	print(str(ct) + '\n' + '\n'.join([''.join(row) for row in board]))
main()


a = int(input())
if a % 2 == 0:
	print(a ** 2 // 2)
else:
	print((a ** 2 + 1) // 2)
for i in range(0, a):
	if i % 2 == 0:
		for j in range(0, a):
			if j % 2 == 0:
				print('C', end='')
			else:
				print('.', end='')
		print()
	else:
		for j in range(0, a):
			if j % 2 == 0:
				print('.', end='')
			else:
				print('C', end='')
		print()


def print_chessboard(size: int) -> None:
	n_coders = size * size // 2
	line = ['C.' * (size // 2), '.C' * (size // 2)]
	if size % 2 != 0:
		n_coders += 1
		line[0] += 'C'
		line[1] += '.'
	print(n_coders)
	for i in range(size):
		print(line[i % 2])
	return

def main() -> int:
	n = int(input())
	print_chessboard(n)
	return 0
main()


a = int(input())
if a % 2 == 0:
	print(a ** 2 // 2)
elif a % 2 != 0:
	print((a ** 2 + 1) // 2)
p = ''
for i in range(a):
	if i % 2 == 0:
		p += 'C'
	elif i % 2 != 0:
		p += '.'
q = ''
for i in range(a):
	if i % 2 != 0:
		q += 'C'
	elif i % 2 == 0:
		q += '.'
for j in range(a):
	if j % 2 == 0:
		print(p)
	elif j % 2 != 0:
		print(q)


import sys
import math
n = int(input())
print((n * n + 1) // 2)
for i in range(n):
	s = ''
	s = ''.join(['.' if (i + j) % 2 else 'C' for j in range(n)])
	print(s)


n = int(input())
board = [['.' for _ in range(n)] for _ in range(n)]
count = 0
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			board[i][j] = 'C'
			count += 1
print(count)
for i in range(n):
	print(''.join(board[i]))


n = int(input())
m = n * n
print(m // 2 if m % 2 == 0 else m // 2 + 1)
y = 0
for i in range(n):
	if n % 2 == 0:
		y = 1 - y
	line = []
	for j in range(n):
		y = 1 - y
		if y:
			line.append('C')
		else:
			line.append('.')
	print(''.join(line))


n = int(input())
print((n ** 2 + 1) // 2)
r = 'C.' * n
for i in range(n):
	print(r[n * (i % 2):n * (i % 2) + n][::[-1, 1][i % 2]])


N = int(input())
CodeR = 0
if N % 2 == 0:
	CodeR = N * N // 2
elif N % 2 != 0:
	CodeR = N * (N // 2) + N // 2 + 1
print(CodeR)
for i in range(N):
	if i % 2 == 0:
		if N % 2 == 0:
			print('C.' * (N // 2))
		elif N % 2 != 0:
			print('C.' * (N // 2) + 'C')
	elif N % 2 == 0:
		print('.C' * (N // 2))
	elif N % 2 != 0:
		print('.C' * (N // 2) + '.')


n = int(input())
k = n // 2
print(n * k + n % 2 * (k + 1))
s = 'C.' * (k + 1)
for i in range(n):
	q = i % 2
	print(s[q:n + q])


n = int(input())
if n % 2 == 0:
	print(int(n * n / 2))
else:
	print(int((1 + n // 2) * n - n // 2))
ans = ''
if n % 2 == 0:
	for i in range(n):
		ans = ''
		for j in range(int(n / 2)):
			if i % 2 == 0:
				ans = ans + 'C.'
			else:
				ans = ans + '.C'
		print(ans)
else:
	for i in range(n):
		ans = ''
		for j in range(n):
			if i % 2 == 0:
				if j % 2 == 0:
					ans = ans + 'C'
				else:
					ans = ans + '.'
			elif j % 2 == 1:
				ans = ans + 'C'
			else:
				ans = ans + '.'
		print(ans)


n = int(input())
a = n // 2
b = n % 2
ans = (a + b) ** 2 + a ** 2
print(ans)
for i in range(a):
	print('C.' * a + 'C' * b)
	print('.C' * a + '.' * b)
if b == 1:
	print('C.' * a + 'C' * b)


n = int(input())
if n == 1:
	print('1')
	print('C')
elif n % 2 == 0:
	temp = int(n / 2)
	s1 = 'C.'
	s1 = s1 * temp
	s2 = '.C'
	s2 = s2 * temp
	ans = n * int(n / 2)
	print(int(ans))
	for i in range(temp):
		print(s1)
		print(s2)
else:
	temp = int(n / 2)
	s1 = 'C.'
	s1 = s1 * temp
	s1 += 'C'
	s2 = '.C'
	s2 = s2 * temp
	s2 += '.'
	ans = int(n / 2) * int(n / 2)
	ans += (int(n / 2) + 1) * (int(n / 2) + 1)
	print(int(ans))
	for i in range(temp):
		print(s1)
		print(s2)
	print(s1)


n = int(input())
(str1, str2) = ([], [])
for i in range(n):
	if i % 2 == 0:
		str1.append('C')
		str2.append('.')
	else:
		str2.append('C')
		str1.append('.')
moves = str1.count('C') ** 2 + str2.count('C') ** 2
print(moves)
for i in range(n):
	if i % 2 == 0:
		print(''.join(str1))
	else:
		print(''.join(str2))


T_ON = 0
DEBUG_ON = 1
MOD = 998244353

def solve():
	n = read_int()
	s = 'C.' * n
	M = []
	for r in range(n):
		if r % 2 == 0:
			M.append(s[:n])
		else:
			M.append(s[1:n + 1])
	ans = n * (n // 2)
	if n % 2:
		ans += (n + 1) // 2
	print(ans)
	for row in M:
		print(row)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def fib_to_n(n):
	f = []
	(a, b) = (0, 1)
	while a <= n:
		f.append(a)
		(a, b) = (b, a + b)
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


n = int(input())
c = [['.'] * n for i in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		if i & 1 == 0 and j & 1 == 0:
			c[i][j] = 'C'
			ans += 1
		if i & 1 == 1 and j & 1 == 1:
			c[i][j] = 'C'
			ans += 1
print(ans)
for i in range(n):
	print(''.join(c[i]))


hat = int(input())
total = 0
lst = []
for i in range(0, hat):
	if i % 2 == 0:
		x = ''
		for j in range(hat):
			if j % 2 == 0:
				x += 'C'
				total += 1
			else:
				x += '.'
		lst.append(x)
	else:
		y = ''
		for j in range(hat):
			if j % 2 == 0:
				y += '.'
			else:
				y += 'C'
				total += 1
		lst.append(y)
print(total)
print('\n'.join(lst))


n = int(input())
print(n * n // 2 + n % 2)
for i in range(n):
	line = ''
	for j in range(n):
		if (i + j) % 2 == 0:
			line += 'C'
		else:
			line += '.'
	print(line)


import math
n = int(input())
print(math.ceil(n * n / 2))
for i in range(n):
	if i % 2 == 0:
		print('C.' * (n // 2) + 'C' * (n % 2))
	else:
		print('.C' * (n // 2) + '.' * (n % 2))


n = int(input())
if n % 2 == 0:
	a = n // 2
	print(n ** 2 // 2)
	for i in range(1, n + 1):
		if i % 2 != 0:
			print('C.' * a)
		else:
			print('.C' * a)
else:
	a = n // 2
	print((a + 1) * (a + 1) + a * a)
	for i in range(1, n + 1):
		if i % 2 != 0:
			print('C.' * a + 'C')
		else:
			print('.C' * a + '.')


n = int(input())
print(n * n // 2 if n % 2 == 0 else n * (n // 2) + n // 2 + 1)
a = [['.' for i in range(n)] for j in range(n)]
b = [''] * n
for i in range(n):
	for j in range(n):
		pos_1 = i % 2 == 0 and j % 2 == 0
		pos_2 = i % 2 == 1 and j % 2 == 1
		if pos_1 or pos_2:
			a[i][j] = 'C'
	b[i] = ''.join(a[i])
for i in range(n):
	print(b[i], flush=False)


def sol(n):
	if n & 1:
		ans = (pow(n, 2) + 1) // 2
	else:
		ans = pow(n, 2) // 2
	if n == 1:
		print(ans)
		print('C')
	else:
		print(ans)
		s = ''
		a = ''
		for i in range(n):
			if i % 2 == 0:
				s += 'C'
				a += '.'
			else:
				s += '.'
				a += 'C'
		for i in range(n):
			if i % 2 == 0:
				print(s)
			else:
				print(a)
n = int(input())
sol(n)


n = int(input())
if n % 2 == 0:
	print(int(n ** 2 / 2))
else:
	print(int((n ** 2 + 1) / 2))
odds = ''
evens = ''
for i in range(0, n):
	if i % 2 == 0:
		evens += 'C'
	else:
		evens += '.'
for i in range(0, n):
	if i % 2 == 0:
		odds += '.'
	else:
		odds += 'C'
for i in range(0, n):
	if i % 2 == 0:
		print(evens)
	else:
		print(odds)


n = int(input())
a = []
cnt = 0
for i in range(n):
	if not i & 1:
		s = ''
		for j in range(n):
			if not j & 1:
				s += 'C'
				cnt += 1
			else:
				s += '.'
		a.append(s)
	else:
		s = ''
		for j in range(n):
			if not j & 1:
				s += '.'
			else:
				s += 'C'
				cnt += 1
		a.append(s)
print(cnt)
for i in a:
	print(i)


import sys
n = int(sys.stdin.readline())
if n % 2 == 0:
	print(int(n ** 2 / 2))
	t = []
	for i in range(n):
		if i % 2 == 0:
			t.append('C')
		else:
			t.append('.')
	a = ''.join(t)
	b = a[::-1]
	for i in range(n):
		if i % 2 == 0:
			print(a)
		else:
			print(b)
else:
	i = (int(n / 2) + 1) ** 2
	j = int(n / 2) ** 2
	a = '.'.join(['C' for x in range(int(n / 2) + 1)])
	b = 'C'.join(['.' for x in range(int(n / 2 + 1))])
	print(i + j)
	for i in range(n):
		if i % 2 == 0:
			print(a)
		else:
			print(b)


n = int(input())
if n % 2 == 0:
	print(n ** 2 // 2)
else:
	print((n ** 2 + 1) // 2)
var = 'C'
f = 1
for i in range(n):
	for j in range(n):
		if j == 0 and i >= 1:
			if var == 'C':
				var = '.'
				f = 0
			elif var == '.':
				var = 'C'
				f = 1
		if f == 1:
			print('C', end='')
			f = (f + 1) % 2
		else:
			print('.', end='')
			f = (f + 1) % 2
	print()


n = int(input())
if n % 2 == 0:
	A = n // 2 * (n // 2)
	B = A + A
	print(B)
else:
	A = n // 2 + 1
	B = A * A
	C = n // 2
	D = C * C
	print(B + D)
if 1:
	for i in range(0, n):
		for j in range(0, n):
			if i % 2 == 0:
				if j % 2 == 0:
					print('C', end='')
				else:
					print('.', end='')
			elif j % 2 == 0:
				print('.', end='')
			else:
				print('C', end='')
		print()


n = int(input())
pair = n // 2
num_C = pair * 2
odd = 'C.' * pair
eve = '.C' * pair
if n % 2 != 0:
	odd += 'C'
	eve += '.'
	num_C += 1
	num_C *= n // 2
	num_C += pair + 1
else:
	num_C *= n // 2
print(num_C)
for x in range(1, n + 1):
	if x % 2 != 0:
		print(odd)
	else:
		print(eve)


a = int(input())
b = 'C.'
print((a ** 2 + 1) // 2)
for i in range(a):
	c = ''
	for j in range(a):
		c += b[(i + j) % 2]
	print(c)


n = int(input())
board = [['.' for i in range(n)] for j in range(n)]
for i in range(n):
	for j in range(n):
		if i % 2 == 0:
			if j % 2 == 0:
				board[i][j] = 'C'
		elif j % 2 == 1:
			board[i][j] = 'C'
if n % 2 == 0:
	print(n * n // 2)
else:
	print((n * n + 1) // 2)
for row in board:
	for elem in row:
		print(elem, end='')
	print()


n = int(input())
print((n * n + 1) // 2)
for i in range(n):
	print(('C.' * 1000)[i % 2:i % 2 + n])


n = int(input())
mat = [['.'] * n for i in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			mat[i][j] = 'C'
			ans += 1
print(ans)
for i in mat:
	print(*i, sep='')


n = int(input())
if not n % 2:
	num = (n // 2) ** 2 * 2
else:
	num = (n // 2) ** 2 + (n // 2 + 1) ** 2
print(num)
for i in range(n):
	if not i % 2:
		print('C.' * (n // 2) + 'C' * (n % 2))
	else:
		print('.C' * (n // 2) + '.' * (n % 2))


n = int(input())
row1 = 'C.' * (n // 2)
row2 = '.C' * (n // 2)
if n % 2 == 0:
	print(n * n // 2)
	res = (row1 + '\n' + row2 + '\n') * (n // 2)
	print(res)
else:
	print(n * (n // 2 + 1) - n // 2)
	row1 += 'C'
	row2 += '.'
	res = (row1 + '\n' + row2 + '\n') * (n // 2) + row1
	print(res)


field = int(input())
print((field ** 2 + 1) // 2)
flag = 0
for i in range(field):
	print(('C.' * 1000)[i:i + field])


import math
n = int(input())
print(math.ceil(n * n / 2))
t = 0
for i in range(n):
	if n % 2 == 0:
		t += 1
	for j in range(n):
		if t % 2:
			c = '.'
		else:
			c = 'C'
		print(c, end='')
		t += 1
	print()


n = int(input())
field = [list('.' * n) for i in range(n)]
num = 0
for i in range(0, n, 2):
	for j in range(0, n, 2):
		field[i][j] = 'C'
		num += 1
for i in range(1, n, 2):
	for j in range(1, n, 2):
		field[i][j] = 'C'
		num += 1
print(num)
for i in range(n):
	print(''.join(field[i]))


n = int(input())
ans = 0
s = [['.' for _ in range(n)] for i in range(n)]
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			ans += 1
			s[i][j] = 'C'
print(ans)
for i in range(n):
	print(''.join(s[i]))


import math
n = int(input())
if n % 2 == 0:
	print(n * (n // 2))
else:
	print((n // 2 + 1) ** 2 + (n // 2) ** 2)
c = 0
for i in range(n):
	if i % 2 == 0:
		if n % 2 == 0:
			print('C.' * math.ceil(n / 2))
		else:
			print(('C.' * math.ceil(n / 2))[:-1])
	elif n % 2 == 0:
		print('.C' * math.ceil(n / 2))
	else:
		print(('.C' * math.ceil(n / 2))[:-1])


def solve(n):
	m = [['.'] * (n + 2) for _ in range(n + 2)]
	c = 0
	for i in range(1, n + 1):
		for j in range(1, n + 1):
			if m[i + 1][j] == '.' and m[i - 1][j] == '.' and (m[i][j - 1] == '.') and (m[i][j + 1] == '.'):
				m[i][j] = 'C'
				c += 1
	print(c)
	for i in range(1, n + 1):
		print(''.join(m[i][1:-1]))

def main():
	n = int(input())
	solve(n)
main()


n = int(input())
print((n * n + 1) // 2)
board = [['.'] * n for i in range(n)]
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			board[i][j] = 'C'
for line in board:
	print(''.join(line))


sa = int(input())
print(int((sa ** 2 + 1) / 2))
for x in range(sa):
	newchain = ''
	if x % 2 == 0:
		while len(newchain) < sa:
			if len(newchain) < sa:
				newchain += 'C'
			if len(newchain) < sa:
				newchain += '.'
	if x % 2 == 1:
		while len(newchain) < sa:
			if len(newchain) < sa:
				newchain += '.'
			if len(newchain) < sa:
				newchain += 'C'
	print(newchain)


n = int(input())
k = 0
s = 'C.'
ss = '.C'
s1 = s * (n // 2)
s2 = ss * (n // 2)
if n % 2 == 1:
	s1 += 'C'
	s2 += '.'
count = 0
for i in range(n // 2):
	count += s1.count('C')
	count += s2.count('C')
if n % 2 == 1:
	count += s1.count('C')
print(count)
for i in range(n // 2):
	print(s1)
	print(s2)
if n % 2 == 1:
	print(s1)


n = int(input())
board = []
count = 0
for i in range(0, n):
	row = []
	if i % 2 == 0:
		for j in range(0, n):
			if j % 2 == 0:
				row.append('C')
				count += 1
			else:
				row.append('.')
	else:
		for j in range(0, n):
			if j % 2 != 0:
				row.append('C')
				count += 1
			else:
				row.append('.')
	board.append(row)
print(count)
for row in board:
	print(''.join(row))


n = int(input())
L = []
ans = 0
for i in range(n):
	s = ''
	for j in range(n):
		if i % 2 == j % 2:
			s = s + 'C'
			ans += 1
		else:
			s = s + '.'
	L.append(s)
print(ans)
for s in L:
	print(s)


n = int(input())
print((n * n + 1) // 2)
for i in range(n):
	s = ''
	for j in range(n):
		if (i + j) % 2 == 0:
			s += 'C'
		else:
			s += '.'
	print(s)


n = int(input())
tc = 0
ans = []
for i in range(n):
	if i % 2 == 0:
		c = 0
		y = ''
		for j in range(n):
			if j & 1 == 0:
				y += 'C'
				c += 1
			else:
				y += '.'
		ans.append(y)
		tc += c
	elif i & 1:
		y = ''
		c = 0
		for j in range(n):
			if j & 1:
				y += 'C'
				c += 1
			else:
				y += '.'
		ans.append(y)
		tc += c
print(tc)
for i in ans:
	print(i)


num = int(input())
l1 = ('C.' * ((num + 1) // 2))[:num]
l2 = ('.C' * ((num + 1) // 2))[:num]
print((num ** 2 + 1) // 2)
for i in range(num):
	if i % 2 == 0:
		print(l1)
	else:
		print(l2)


n = int(input())
ans = []
t = n
number = 0
while n != 0:
	if n % 2 == 0:
		temp = '.C' * t
		temp = temp[:t]
		ans.append(temp)
		number = number + temp.count('C')
	else:
		temp = 'C.' * t
		temp = temp[:t]
		number = number + temp.count('C')
		ans.append(temp)
	n = n - 1
print(number)
for i in ans:
	print(i)


def ve_bang(n):
	if n % 2:
		print(int(n * n / 2) + 1)
		for i in range(n):
			if i % 2:
				print('.C' * round((n - 1) / 2) + '.')
			else:
				print('C.' * round((n - 1) / 2) + 'C')
	else:
		print(round(n * n / 2))
		for i in range(n):
			if i % 2:
				print('C.' * round(n / 2))
			else:
				print('.C' * round(n / 2))
	pass
n = int(input())
ve_bang(n)


from collections import *
import sys
input = sys.stdin.readline

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
n = ri()
if n % 2 == 0:
	print(n // 2 * n)
	for i in range(n):
		if i % 2 == 0:
			print('C.' * (n // 2))
		else:
			print('.C' * (n // 2))
if n % 2 == 1:
	k = n // 2
	print((k + 1) ** 2 + k ** 2)
	for i in range(n):
		if i % 2 == 0:
			print('C.' * k + 'C')
		else:
			print('.C' * k + '.')


n = int(input())
arr = ''
brr = ''
for x in range(n):
	if x % 2:
		arr += 'C'
		brr += '.'
	else:
		arr += '.'
		brr += 'C'
print((n * n + 1) // 2)
for x in range(n):
	if x % 2:
		print(arr)
	else:
		print(brr)


n = int(input())
if n % 2 == 1:
	a = n // 2 + 1
	b = n - a
	print(a ** 2 + b * (a - 1))
else:
	a = n // 2
	print(a * n)
line = ''
for i in range(1, 3):
	if i % 2 == 0:
		point = False
	else:
		point = True
	for j in range(1, n + 1):
		if point:
			line += 'C'
			point = False
		else:
			line += '.'
			point = True
	line += '\n'
ans = line.split('\n')
for i in range(1, n + 1):
	if i % 2 == 0:
		print(ans[1])
	else:
		print(ans[0])


n = int(input())
rows = []
c = 0
for i in range(n):
	c += n // 2
	if n % 2 != 0 and i % 2 == 0:
		c += 1
	if i % 2 == 0:
		row = ['C.'] * (n // 2)
		if n % 2 == 1:
			row += ['C']
	else:
		row = ['.C'] * (n // 2)
		if n % 2 == 1:
			row += ['.']
	rows.append(row)
print(c)
for row in rows:
	print(''.join(row))


n = int(input())
print((n * n + 1) // 2)
print('\n'.join([''.join(('C.'[(i + j) % 2] for i in range(n))) for j in range(n)]))


from math import ceil
n = int(input())
print(ceil(n * n / 2))
for i in range(1, n + 1):
	s = ''
	if i % 2 != 0:
		for j in range(1, n + 1):
			if j % 2 != 0:
				s += 'C'
			else:
				s += '.'
	else:
		for j in range(1, n + 1):
			if j % 2 != 0:
				s += '.'
			else:
				s += 'C'
	print(s)


def main():
	n = int(input())
	ans = 0
	crow1 = n // 2
	row1 = 'C.' * (n // 2)
	if n % 2 == 1:
		row1 = row1 + 'C'
		crow1 += 1
	crow2 = n // 2
	row2 = '.C' * (n // 2)
	if n % 2 == 1:
		row2 = row2 + '.'
	i = 0
	out = []
	while i < n:
		out.append(row1)
		ans += crow1
		i += 1
		if i < n:
			out.append(row2)
			ans += crow2
			i += 1
	print(ans)
	print('\n'.join(out))
main()


import math
n = int(input())
cnt = 0
ans = []
for i in range(n):
	s = ['.'] * n
	for j in range(n):
		if j % 2 == i % 2:
			s[j] = 'C'
			cnt += 1
	ans.append(''.join(s))
print(cnt)
for x in ans:
	print(x)


n = int(input())
print(n * n // 2 + n % 2)
x = 'C.' * (n // 2)
y = '.C' * (n // 2)
for i in range(0, n):
	if i % 2 == 0:
		print(x, end='')
		if n % 2:
			print('C', end='')
	if i % 2 == 1:
		print(y, end='')
		if n % 2:
			print('.', end='')
	print()


n = int(input())
even = 'C.' * (n // 2)
odd = '.C' * (n // 2)
evenElem = even.count('C')
oddElem = odd.count('C')
total = 0
if n % 2 != 0:
	even += 'C'
	odd += '.'
	total += (evenElem + 1) * (n // 2 + 1) + oddElem * (n // 2)
else:
	total += (evenElem + oddElem) * n // 2
print(total)
for x in range(n):
	if x % 2 == 0:
		print(even)
	else:
		print(odd)


n = int(input())
if n % 2 == 0:
	print(int(n / 2 * n))
	for i in range(int(n / 2)):
		print(int(n / 2) * 'C.')
		print(int(n / 2) * '.C')
elif n % 2 != 0:
	print(int(n / 2 + 1) ** 2 + int(n / 2) ** 2)
	for i in range(int(n / 2)):
		print(int(n / 2) * 'C.' + 'C')
		print(int(n / 2) * '.C' + '.')
	print(int(n / 2) * 'C.' + 'C')


n = int(input())
tot = 0
out = ''
for i in range(n):
	for ii in range(n):
		if (i + ii) % 2 == 0:
			out += 'C'
			tot += 1
		else:
			out += '.'
	out += '\n'
print(tot)
print(out)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
import copy
import time
starttime = time.time()
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
except:
	pass
n = L()[0]
print(n * n // 2 + n * n % 2)
for i in range(n):
	for j in range(n):
		if i % 2 == j % 2:
			print('C', end='')
		else:
			print('.', end='')
	print()
endtime = time.time()


n = int(input())
if n % 2 == 0:
	p = n * n // 2
else:
	p = n * (n // 2) + (n // 2 + 1)
print(p)
c1 = []
c2 = []
for i in range(n):
	if i % 2 == 0:
		c1.append('C')
		c2.append('.')
	else:
		c1.append('.')
		c2.append('C')
c3 = ''.join(c1)
c4 = ''.join(c2)
s = 1
while n:
	if s == 1:
		print(c3)
	else:
		print(c4)
	s = 1 - s
	n -= 1


n = int(input())
print((n * n + 1) // 2)
for i in range(n):
	print(('C.' * 600)[i % 2:i % 2 + n])


n = int(input())
s = n * n
print(s // 2 + s % 2)
(line_1, line_2) = ('C.' * (n // 2 + 1), '.C' * (n // 2 + 1))
for i in range(n):
	if i % 2 == 0:
		print(line_1[:n])
	else:
		print(line_2[:n])


n = int(input())
if n % 2 == 0:
	print(int(n ** 2 / 2))
	for cont in range(0, n, 2):
		s = 'C.' * int(n / 2)
		print(s)
		s = '.C' * int(n / 2)
		print(s)
else:
	print(int((n ** 2 + 1) / 2))
	print('C.' * int(n / 2) + 'C')
	for cont in range(1, n, 2):
		print('.C' * int(n / 2) + '.')
		print('C.' * int(n / 2) + 'C')


n = int(input())
l = []
nb = 0
for i in range(n):
	l.append([])
	if i % 2 == 0:
		for k in range(n):
			if k % 2 == 0:
				l[i].insert(k, 'C')
				nb += 1
			else:
				l[i].insert(k, '.')
	else:
		for k in range(n):
			if k % 2 == 0:
				l[i].insert(k, '.')
			else:
				l[i].insert(k, 'C')
				nb += 1
print(nb)
for i in range(n):
	print(''.join(map(str, l[i])))


import math
n = int(input())
(even, odd) = ('', '')
for i in range(n):
	even += '.' if i % 2 else 'C'
	odd += 'C' if i % 2 else '.'
print(math.ceil(n * n / 2))
for i in range(n):
	print(odd if i % 2 else even)


n = int(input())
t = ''
c = 0
for i in range(n):
	for j in range(n):
		if i % 2 == 0:
			if j % 2 == 0:
				t += 'C'
				c += 1
			else:
				t += '.'
		elif j % 2 == 0:
			t += '.'
		else:
			t += 'C'
			c += 1
	t += '\n'
print(c)
print(t)


n = int(input())
row_count = 0
if n == 1 or n == 2:
	print(n)
elif n % 2 == 0:
	print(n ** 2 // 2)
else:
	a = n // 2 + 1
	b = n // 2
	print(a * a + b * b)
while row_count < n:
	column_count = 0
	while column_count < n:
		if row_count % 2 == 0 and column_count % 2 == 0:
			print('C', end='')
		elif row_count % 2 == 0 and column_count % 2 == 1:
			print('.', end='')
		elif row_count % 2 == 1 and column_count % 2 == 0:
			print('.', end='')
		elif row_count % 2 == 1 and column_count % 2 == 1:
			print('C', end='')
		column_count += 1
	print('')
	row_count += 1


def ii():
	return int(input())

def ss():
	return [x for x in input()]

def si():
	return [int(x) for x in input().split()]

def mi():
	return map(int, input().split())
a = ii()
s = 0
if a % 2 == 0:
	print(a * a // 2)
else:
	print(a // 2 * (a // 2) + (a // 2 + 1) * (a // 2 + 1))
for i in range(a):
	if a % 2 == 0:
		s = (s + 1) % 2
	for i in range(a):
		if s:
			print('.', end='')
		else:
			print('C', end='')
		s = (s + 1) % 2
	print()


n = int(input())
c = 0
for i in range(1, n, 2):
	c += 2 * i
if n % 2 == 1:
	c += n
s1 = ''
s2 = ''
for i in range(n):
	if i % 2 == 1:
		s1 += 'C'
		s2 += '.'
	else:
		s1 += '.'
		s2 += 'C'
print(c)
for i in range(n):
	if i % 2 == 1:
		print(s1)
	else:
		print(s2)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
N = int(input())
A = [['.' for _ in range(N)] for _ in range(N)]
if N % 2 == 0:
	print(N * N // 2)
else:
	a = N // 2 + 1
	print(a * a + (a - 1) ** 2)
for r in range(N):
	s = 1 if r % 2 == 1 else 0
	for c in range(s, N, 2):
		A[r][c] = 'C'
for row in A:
	print(''.join(row))


n = int(input())
t = n * n / 2 + 0.5
print(int(t))
if n % 2 == 0:
	for i in range(n):
		if i % 2 == 0:
			print('C.' * (n // 2))
		else:
			print('.C' * (n // 2))
else:
	for j in range(n):
		if j % 2 == 0:
			print('C.' * (n // 2), end='')
			print('C')
		else:
			print('.C' * (n // 2), end='')
			print('.')


n = int(input())
r = n % 2 == 0
if n == 1:
	print('1\nC')
	exit(0)
print(n * n // 2 + (not r))
for i in range(n):
	print(('C.' * 600)[i % 2:i % 2 + n])


n = int(input())
string = ''
m = 0
p = 0
count = 0
for i in range(1, n + 1):
	for j in range(1, n + 1):
		if i % 2 == 0:
			if j % 2 != 0:
				string += '.'
			else:
				string += 'C'
		elif j % 2 != 0:
			string += 'C'
		else:
			string += '.'
print(string.count('C'))
for i in range(n):
	p += n
	print(string[m:p])
	m += n


n = int(input())
if n == 1:
	print(1)
	print('C')
	exit()
a = ''
b = ''
for i in range(n):
	if i % 2 == 0:
		a = a + 'C'
		b = b + '.'
	else:
		a = a + '.'
		b = b + 'C'
if n % 2 == 0:
	print(n ** 2 // 2)
else:
	print(n ** 2 // 2 + 1)
flag = True
for i in range(n):
	if flag == True:
		print(a)
		flag = False
	else:
		print(b)
		flag = True


from math import ceil
a = int(input())
b = []
print(ceil(a * a / 2))
for i in range(1, a + 1):
	if i % 2 == 1:
		print(*list('C' * ceil(a / 2)), sep='.', end='.\n' if a % 2 == 0 else '\n')
	else:
		print(*list('.' * ceil(a / 2)), sep='C', end='C\n' if a % 2 == 0 else '\n')


n = int(input())
(l, l1) = ([], [])
if n % 2 != 0:
	print(1 + n // 2 * n + n // 2)
	l.append('C.' * (n // 2))
	l.append('C')
	l1.append('.C' * (n // 2))
	l1.append('.')
	for i in range(n):
		if i % 2 == 0:
			print(*l, sep='')
		else:
			print(*l1, sep='')
else:
	print(n // 2 * n)
	l.append('C.' * (n // 2))
	l1.append('.C' * (n // 2))
	for i in range(n):
		if i % 2 == 0:
			print(*l, sep='')
		else:
			print(*l1, sep='')


n = int(input())
arr = [['.' for i in range(n)] for j in range(n)]
c = 0
for i in range(n):
	for j in range(n):
		if i % 2 == 0 and j % 2 == 0 or (i % 2 != 0 and j % 2 != 0):
			arr[i][j] = 'C'
			c += 1
print(c)
for i in range(n):
	x = ''.join(arr[i])
	print(x)


n = int(input())
print((n ** 2 + 1) // 2)
(k, mod_) = divmod(n, 2)
(s1, s2) = ('C.' * k, '.C' * k)
if mod_:
	(s1, s2) = (s1 + 'C', s2 + '.')
for i in range(n):
	print(s2 if i % 2 else s1)


def answer():
	a = int(input())
	print(int(a ** 2 / 2) + a % 2)
	i = 1
	while i <= a:
		j = 1
		c_out = ''
		while j <= a:
			if j % 2 == i % 2:
				start = 'C'
			else:
				start = '.'
			c_out += start
			j += 1
		print(c_out)
		i += 1
answer()


n = int(input())
p = 0
q = 0
a = []
b = []
for x in range(1, n + 1):
	a += ['C']
	p += 1
	if p == n:
		break
	a += ['.']
	p += 1
	if p == n:
		break
for y in range(1, n + 1):
	b += ['.']
	q += 1
	if q == n:
		break
	b += ['C']
	q += 1
	if q == n:
		break
if n % 2 == 0:
	print(n * n // 2)
	p = 0
	for x in range(1, n + 1):
		print(''.join([str(x) for x in b]))
		p += 1
		if p == n:
			break
		print(''.join([str(x) for x in a]))
		p += 1
		if p == n:
			break
else:
	temp = n * n // 2
	print(temp + 1)
	p = 0
	for x in range(1, n + 1):
		print(''.join([str(x) for x in a]))
		p += 1
		if p == n:
			break
		print(''.join([str(x) for x in b]))
		p += 1
		if p == n:
			break


from math import ceil
n = int(input())
ind1 = 0
Select1 = 1
Select2 = -1
print(ceil(n / 2) ** 2 + ceil((n - 1) / 2) ** 2)
if n % 2 == 0:
	s1 = 'C.' * (n // 2)
	s2 = '.C' * (n // 2)
	for i in range(n // 2):
		print(s1)
		print(s2)
else:
	s1 = 'C.' * ((n + 1) // 2)
	s2 = '.C' * ((n + 1) // 2)
	for i in range((n + 1) // 2 - 1):
		print(s1[:n])
		print(s2[:n])
	print(s1[:n])


import math
n = int(input())
print(math.ceil(n * n / 2))
odd_s = ''
even_s = ''
for i in range(1, n + 1):
	odd_s += 'C' if i % 2 == 1 else '.'
	even_s += 'C' if i % 2 == 0 else '.'
for i in range(1, n + 1):
	if i % 2 == 1:
		print(odd_s)
	else:
		print(even_s)


import math
n = int(input())
ans = math.ceil(n * n / 2)
print(ans)
s = ''
s1 = ''
for i in range(n):
	if i % 2 == 0:
		s += 'C'
	else:
		s += '.'
for i in range(n):
	if i % 2 == 0:
		s1 += '.'
	else:
		s1 += 'C'
for i in range(n):
	if i % 2 == 0:
		print(s)
	else:
		print(s1)


from sys import stdin, stdout
inints = lambda : [int(x) for x in stdin.readline().split()]
fastwrite = lambda s: stdout.write(str(s) + '\n')
irange = lambda x, y: range(x, y + 1)
(n,) = inints()
fastwrite(n ** 2 // 2 if n % 2 == 0 else (n ** 2 + 1) // 2)
for i in irange(1, n):
	for j in irange(1, n):
		stdout.write('C' if (i + j) % 2 == 0 else '.')
	stdout.write('\n')


par = 'C.'
impar = '.C'
L = []
n = int(input())
cont = 0
for k in range(n):
	s = ''
	if k % 2:
		s = impar * (-1 * (-n // 2))
	else:
		s = par * (-1 * (-n // 2))
	cont += s[:n].count('C')
	L += [s[:n]]
print(cont)
print('\n'.join(L))


x = int(input())
if x % 2 == 0:
	print(int(x * x / 2))
elif x % 2 == 1:
	print(int((x + 1) * (x + 1) / 4 + (x - 1) * (x - 1) / 4))
if x % 2 == 1:
	for i in range(x):
		if i % 2 == 0:
			print(int((x - 1) / 2) * 'C.', end='')
			print('C')
		elif i % 2 == 1:
			print(int((x - 1) / 2) * '.C', end='')
			print('.')
if x % 2 == 0:
	for i in range(x):
		if i % 2 == 0:
			print('C.' * int(x / 2))
		elif i % 2 == 1:
			print('.C' * int(x / 2))


import math
n = int(input())
answer = math.ceil(n * n / 2.0)
list1 = [['.' for i in range(n)] for j in range(n)]
for i in range(n):
	for j in range(n):
		if i % 2 == 0 and j % 2 == 0:
			list1[i][j] = 'C'
		elif i % 2 == 1 and j % 2 == 1:
			list1[i][j] = 'C'
print(answer)
for i in range(n):
	for j in range(n):
		print(list1[i][j], end='')
	print()


n = int(input())
s = [['.'] * n for i in range(n)]
print(n * n // 2 + n % 2)
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			s[i][j] = 'C'
print('\n'.join([''.join(l) for l in s]))


N = int(input())
print((N // 2 + N % 2) ** 2 + (N // 2) ** 2)
for i in range(N):
	print(''.join(['C' if (j + i) % 2 == 0 else '.' for j in range(N)]))


n = int(input())
a = [[0] * n for i in range(n)]
k = 0
for i in range(n):
	for j in range(n):
		a[i][j] = '.'
for i in range(n):
	for j in range(n):
		if i % 2 == 1 and j % 2 == 1:
			a[i][j] = 'C'
			k += 1
		if i % 2 == 0 and j % 2 == 0:
			a[i][j] = 'C'
			k += 1
print(k)
for i in range(n):
	for j in range(n):
		print(a[i][j], end='')
	print()


N = int(input())
ans = N * N // 2 if N % 2 == 0 else N * N // 2 + 1
flg = True
print(ans)
for i in range(N):
	line = ''
	for j in range(N):
		if j % 2 == 0:
			if flg:
				line += 'C'
			else:
				line += '.'
		elif flg:
			line += '.'
		else:
			line += 'C'
	flg = not flg
	print(line)


import math
n = int(input())
print(math.ceil(n * n / 2))
x = ''
for z in range(0, n, 1):
	if z % 2 == 0:
		x += 'C'
	else:
		x += '.'
y = ''
for z in range(0, n, 1):
	if z % 2 == 0:
		y += '.'
	else:
		y += 'C'
for q in range(0, n, 1):
	if q % 2 == 0:
		print(x)
	else:
		print(y)


m = int(input())
s = ''
for i in range(1, m + 1):
	if i % 2 != 0:
		for j in range(1, m + 1):
			if j % 2 != 0:
				s += 'C'
			elif j % 2 == 0:
				s += '.'
	elif i % 2 == 0:
		for j in range(1, m + 1):
			if j % 2 != 0:
				s += '.'
			elif j % 2 == 0:
				s += 'C'
print(s.count('C'))
for k in range(0, len(s), m):
	print(s[k:k + m])


f = lambda : map(int, input().split())
n = int(input())
print([n ** 2 // 2, (n ** 2 + 1) // 2][n % 2])
for i in range(1, n + 1):
	if i % 2 != 0:
		print('C.' * (n // 2) + 'C' if n % 2 != 0 else 'C.' * (n // 2))
	else:
		print('.C' * (n // 2) + '.' if n % 2 != 0 else '.C' * (n // 2))


n = int(input())
if not n % 2:
	num = n * (n // 2)
	s0 = ''
	s1 = ''
	for j in range(n):
		if not j % 2:
			s0 += 'C'
		else:
			s0 += '.'
	s1 = s0[::-1]
	print(num)
	for i in range(n):
		if not i % 2:
			print(s0)
		else:
			print(s1)
else:
	num = n * (n // 2) + (n // 2 + 1)
	s0 = ''
	s1 = ''
	for j in range(n):
		if not j % 2:
			s0 += 'C'
		else:
			s0 += '.'
	for j in range(n):
		if not j % 2:
			s1 += '.'
		else:
			s1 += 'C'
	print(num)
	for i in range(n):
		if not i % 2:
			print(s0)
		else:
			print(s1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	rr = []
	c = 0
	for i in range(n):
		r = []
		for j in range(n):
			if (i + j) % 2 == 0:
				r.append('C')
				c += 1
			else:
				r.append('.')
		rr.append(''.join(r))
	return '{}\n{}'.format(c, '\n'.join(rr))
print(main())


n = int(input())
str = ''
c = 0
for i in range(n):
	for j in range(n):
		if (i + j) % 2:
			str += '.'
		else:
			str += 'C'
			c += 1
	str += '\n'
print(c)
print(str)


num = int(input())
list1 = []
for i in range(num):
	list1.append([])
	for j in range(num):
		if i % 2 == 0:
			if j % 2 == 0:
				list1[i].append('C')
			else:
				list1[i].append('.')
		elif j % 2 == 0:
			list1[i].append('.')
		else:
			list1[i].append('C')
print(str(list1).count('C'))
for i in range(len(list1)):
	print(''.join(list1[i]))


n = int(input())
c = 'C.'
if n % 2 == 0:
	print(int(n * n / 2))
	i = 0
	while i < int(n / 2):
		print(c * int(n / 2))
		print(c[::-1] * int(n / 2))
		i += 1
else:
	print(int(n * n / 2) + 1)
	i = 0
	while i < int(n / 2):
		print(c * int(n / 2) + c[0])
		print(c[::-1] * int(n / 2) + c[-1])
		i += 1
	print(c * int(n / 2) + c[0])


x = False
n = input()
n = int(n)
if n % 2 == 0:
	print(int(n * n / 2))
else:
	print(int((n * n + 1) / 2))
for i in range(n):
	for j in range(n):
		if x == False:
			if j % 2 == 0:
				print('C', end='')
			else:
				print('.', end='')
		if x == True:
			if j % 2 == 0:
				print('.', end='')
			else:
				print('C', end='')
	print('')
	x = not x


n = int(input())
d = []
for k in range(n):
	if k % 2 == 0:
		w = 'C'
	else:
		w = '.'
	while True:
		if len(w) == n:
			break
		elif w[-1] == '.':
			w += 'C'
		else:
			w += '.'
	d.append(w)
print(int((n * n + 1) / 2 // 1))
for k in d:
	print(k)


from math import ceil
n = int(input())
if n % 2 == 0:
	coders = n ** 2 // 2
	print(coders)
	ss = {0: 'C.' * (n // 2), 1: '.C' * (n // 2)}
	for i in range(0, n):
		print(ss[i % 2])
else:
	coders = ceil(n / 2) ** 2 + (n // 2) ** 2
	ss = {0: 'C.' * ceil(n / 2), 1: '.C' * ceil(n / 2)}
	print(coders)
	for i in range(0, n):
		print(ss[i % 2][0:n])


n = int(input())
ans = 0
for i in range(n):
	for i2 in range(n):
		if i % 2 == 0:
			if i2 % 2 == 0:
				ans += 1
		elif i2 % 2 == 1:
			ans += 1
print(ans)
for i in range(n):
	for i2 in range(n):
		if i % 2 == 0:
			if i2 % 2 == 0:
				print('C', end='')
			else:
				print('.', end='')
		elif i2 % 2 == 1:
			print('C', end='')
		else:
			print('.', end='')
		if i2 == n - 1:
			print('')


def main_function():
	n = int(input())
	output_list = []
	count = 0
	for i in range(n):
		lis = []
		if not i % 2:
			for j in range(n):
				if not j % 2:
					lis.append('C')
					count += 1
				else:
					lis.append('.')
		else:
			for j in range(n):
				if not j % 2:
					lis.append('.')
				else:
					lis.append('C')
					count += 1
		s = ''.join(lis)
		output_list.append(s)
	return str(count) + '\n' + '\n'.join(output_list)
print(main_function())


def test(n):
	rowOne = (n + 1) // 2
	rowTwo = n // 2
	lineOne = ''
	lineTwo = str()
	for i in range(n):
		if i % 2 == 0:
			lineOne += 'C'
			lineTwo += '.'
		else:
			lineOne += '.'
			lineTwo += 'C'
	print(rowOne ** 2 + rowTwo ** 2)
	for i in range(n):
		if i % 2 == 0:
			print(lineOne)
		else:
			print(lineTwo)
test(int(input()))


import math

def solve(n):
	count = 0
	arr = []
	for i in range(1, n + 1):
		k = ['.'] * n
		if i % 2 != 0:
			for c in range(0, n, 2):
				k[c] = 'C'
				count += 1
		else:
			for c in range(1, n, 2):
				k[c] = 'C'
				count += 1
		arr.append(''.join(k))
	print(count)
	for i in arr:
		print(i, end='\n')

def main():
	n = int(input())
	solve(n)
main()


n = int(input())
s1 = ''
for i in range(1, n + 1):
	if i % 2:
		s1 += 'C'
	else:
		s1 += '.'
s2 = s1.replace('C.', '.C')
s2 = s2.replace('CC', 'C.')
if n % 2:
	print(int(n / 2 + 1) ** 2 + int(n / 2) ** 2)
else:
	print(int(n ** 2 / 2))
for i in range(1, n + 1):
	if i % 2:
		print(s1)
	else:
		print(s2)


z = int(input())
if z % 2 == 0:
	print(z * (z // 2))
else:
	print(z * z // 2 + 1)
x = ['C' if i % 2 == 0 else '.' for i in range(z)]
y = ['.' if i % 2 == 0 else 'C' for i in range(z)]
for a in range(z):
	if a % 2 == 0:
		print(''.join(x))
	else:
		print(''.join(y))


n = int(input())
L = ['C', '.']
cnt = 0
Ans = ''
for i in range(n):
	x = i % 2
	for j in range(n):
		Ans += L[x]
		if x == 0:
			cnt += 1
		x = 1 - x
	Ans += '\n'
print(cnt)
print(Ans, end='')


import math
x = int(input())
jk = 0
for i in range(x):
	ans = ''
	if i % 2 == 0:
		for k in range(x):
			if k % 2 == 0:
				ans += 'C'
				jk += 1
			else:
				ans += '.'
	else:
		for k in range(x):
			if k % 2 != 0:
				ans += 'C'
				jk += 1
			else:
				ans += '.'
	if i == 0 and x % 2 != 0:
		print(math.floor(x / 2) ** 2 + math.ceil(x / 2) ** 2)
	elif i == 0:
		print(x * jk)
	print(ans)


n = int(input())
t = 0
b = []
for i in range(n):
	x = ''
	for j in range(n):
		if i % 2 == 0:
			if j % 2 == 0:
				x = x + 'C'
				t += 1
			else:
				x = x + '.'
		elif j % 2 == 0:
			x = x + '.'
		else:
			x = x + 'C'
			t += 1
	b.append(x)
print(t)
for i in range(len(b)):
	print(b[i])


n = int(input())
ans = n ** 2
ans = (ans + 1) // 2
print(ans)
temp1 = []
for i in range(n):
	if i % 2 == 0:
		temp1.append('C')
	else:
		temp1.append('.')
temp2 = []
for i in range(n):
	if i % 2 == 0:
		temp2.append('.')
	else:
		temp2.append('C')
arr = []
for i in range(n):
	if i % 2 == 0:
		arr.append(temp1)
	else:
		arr.append(temp2)

def solve(arr):
	for i in range(len(arr)):
		print(arr[i], end='')
	print('')
for i in range(n):
	solve(arr[i])


n = int(input())
t = 0
l_o = list()
for i in range(n):
	l_c = list()
	for j in range(n):
		if (i % 2 + j) % 2 == 0:
			t += 1
			l_c.append('C')
		else:
			l_c.append('.')
	l_o.append(l_c)
print(t)
print('\n'.join((''.join(l_c) for l_c in l_o)))


def chess(n):
	if n == 1:
		print(1)
		print('C')
		return
	flag = True
	tmp1 = ''
	for i in range(n):
		if flag == True:
			tmp1 += 'C'
			flag = False
		elif flag == False:
			tmp1 += '.'
			flag = True
	flag = True
	tmp2 = ''
	for j in range(n):
		if flag == False:
			tmp2 += 'C'
			flag = True
		elif flag == True:
			tmp2 += '.'
			flag = False
	ans = []
	flag = True
	while len(ans) < n:
		if flag == True:
			ans.append(tmp1)
			flag = False
		else:
			ans.append(tmp2)
			flag = True
	c = 0
	for i in ans:
		c += i.count('C')
	print(c)
	for i in ans:
		print(i)
n = int(input())
chess(n)


n = int(input())
r1 = 'C.' * (n // 2)
r2 = '.C' * (n // 2)
if n % 2 == 0:
	print(n * n // 2)
	print((r1 + '\n' + r2 + '\n') * (n // 2))
else:
	print(n * (n // 2 + 1) - n // 2)
	r1 += 'C'
	r2 += '.'
	print((r1 + '\n' + r2 + '\n') * (n // 2) + r1)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	l = [['.'] * n for _ in range(n)]
	if n == 1:
		print(1)
		print('C')
	else:
		sm1 = sm2 = 0
		for i in range(2):
			for j in range(n):
				f = True
				for (y, x) in dd:
					if i + y < 0 or j + x < 0 or i + y >= n or (j + x >= n):
						continue
					if l[i + y][j + x] == 'C':
						f = False
				if f:
					l[i][j] = 'C'
					if i == 0:
						sm1 += 1
					else:
						sm2 += 1
		print(sm1 * -(-n // 2) + sm2 * (n // 2))
		for i in range(n):
			if i % 2 == 0:
				x = l[0]
			else:
				x = l[1]
			print(''.join(x))
main()


import math
n = int(input())
r1 = math.ceil(n / 2)
r2 = math.floor(n / 2)
r3 = r1 * r1 + r2 * r2
print(r3)
l = []
l1 = ['C.' for i in range(n)]
l2 = ['.C' for i in range(n)]
for i in range(n):
	l += [''.join(l1)[:n]]
	l += [''.join(l2)[:n]]
l = l[:n]
for i in l:
	print(i)


count = int(input())
result = int(count / 2) * count
if count % 2 != 0:
	result += int(count / 2) + 1
print(result)
for i in range(count):
	for j in range(count):
		if j % 2 == 0 and i % 2 == 0:
			print('C', end='')
		elif j % 2 != 0 and i % 2 != 0:
			print('C', end='')
		else:
			print('.', end='')
	print('')


w = int(input())
s = 'C.' * w
print((w * w + 1) // 2)
print('\n'.join((s[i:w + i] for i in range(w))))


n = int(input())
print((n * n + 1) // 2)
rt1 = ''
rt2 = ''
for j in range(n):
	rt1 += 'C' if j % 2 == 0 else '.'
for j in range(n):
	rt2 += 'C' if j % 2 == 1 else '.'
for i in range(n):
	print(rt1 if i % 2 == 0 else rt2)


n = int(input())
z = 0
a = []
if n % 2 == 0:
	for i in range(n):
		if i % 2 == 0:
			z += n // 2
			t = 'C.' * (n // 2)
			a.append(t)
		else:
			t = '.C' * (n // 2)
			a.append(t)
			z += n // 2
else:
	for i in range(n):
		if i % 2 == 0:
			z += n // 2 + 1
			t = 'C.' * (n // 2) + 'C'
			a.append(t)
		else:
			z += n // 2
			t = '.C' * (n // 2) + '.'
			a.append(t)
print(z)
for i in range(len(a)):
	print(a[i])


n = int(input())
if not n & 1:
	t = n * n // 2
else:
	t = n * n // 2 + 1
print(t)
for i in range(n):
	r = []
	for j in range(n):
		if j % 2 == 0 and i % 2 == 0 or (j % 2 == 1 and i % 2 == 1):
			r += ['C']
		else:
			r += ['.']
	print(''.join(r))


n = int(input())
oddFlag = n % 2 != 0
half = n // 2
if oddFlag:
	print(((n + 1) // 2) ** 2 + ((n - 1) // 2) ** 2)
else:
	print(n // 2 * n)
for i in range(n):
	if (i + 1) % 2 != 0:
		print('C.' * half, end='')
		if oddFlag:
			print('C', end='')
	else:
		print('.C' * half, end='')
		if oddFlag:
			print('.', end='')
	print()


def main():
	n = int(input())
	c = 0
	data = []
	for i in range(n):
		res = ''
		for j in range(n):
			if i % 2 == 0:
				res += 'C' if j % 2 == 0 else '.'
				if j % 2 == 0:
					c += 1
			else:
				res += 'C' if j % 2 != 0 else '.'
				if j % 2 != 0:
					c += 1
		data.append(res)
	print(c)
	for l in data:
		print(l)
main()


n = int(input())
L = '.C' * 500 + '.'
r = ''
for i in range(1, n + 1):
	r += L[i % 2:i % 2 + n] + '\n'
print(r.count('C'))
print(r[:len(r) - 1])


n = int(input())
if n % 2 == 0:
	print(n // 2 * n)
else:
	print((n // 2 + 1) * n - n // 2)
aux = 0
for i in range(n):
	a = ['.'] * n
	for j in range(aux, n, 2):
		a[j] = 'C'
	if aux == 0:
		aux = 1
	elif aux == 1:
		aux = 0
	print(''.join(map(str, a)))


import math
n = int(input())
print(str(math.ceil(n / 2) * math.ceil(n / 2) + math.floor(n / 2) * math.floor(n / 2)))
start = True
for i in range(n):
	current = start
	for j in range(n):
		if current:
			print('C', end='')
		else:
			print('.', end='')
		current = not current
	print()
	start = not start


n = int(input())
rect = n * n
ans = rect // 2 + rect % 2
print(ans)
temp_s = 'C.' * 2000
for i in range(n):
	if i % 2 == 0:
		print(temp_s[:n])
	else:
		print(temp_s[1:n + 1])


n = int(input())
res = []
x = n
for i in range(n):
	mat = []
	for j in range(n // 2):
		if i % 2 == 0:
			mat.append('C')
			mat.append('.')
		if i % 2 != 0:
			mat.append('.')
			mat.append('C')
		if x % 2 != 0 and i % 2 == 0 and (j == n // 2 - 1):
			mat.append('C')
		if x % 2 != 0 and i % 2 != 0 and (j == n // 2 - 1):
			mat.append('.')
	res.append(mat)
if n % 2 != 0:
	print(n * n // 2 + 1)
else:
	print(n * n // 2)
if n == 1:
	print('C')
else:
	for line in res:
		print(''.join(line))


n = int(input())
print((n // 2) ** 2 + int((n + 1) // 2) ** 2)
for i in range(n):
	print({True: ('C.' * n)[:n], False: ('.C' * n)[:n]}[i % 2 == 0])


n = int(input())
rows = [['C', '.'] * (n // 2) + ['C'] * (n % 2), ['.', 'C'] * (n // 2) + ['.'] * (n % 2)]
print(n ** 2 // 2 + n % 2)
for i in range(0, n):
	print(''.join(rows[i % 2]))


def read():
	return int(input())
n = read()
if n == 1:
	print(1)
elif n % 2 == 0:
	print(n * n // 2)
else:
	ans = (n // 2 + 1) ** 2
	ans += (n - (n // 2 + 1)) * (n // 2)
	print(ans)
for i in range(0, n):
	t = ''
	for j in range(0, n):
		if i % 2 == 0:
			if j % 2 == 0:
				t += 'C'
			else:
				t += '.'
		elif j % 2 == 1:
			t += 'C'
		else:
			t += '.'
	print(t)


n = int(input())
l = []
cnt = 0
for io in range(0, n):
	if io % 2 == 0:
		s = 'C'
	else:
		s = '.'
	for hj in range(0, n - 1):
		if s[len(s) - 1] == 'C':
			s = s + '.'
		else:
			s = s + 'C'
	l.append(s)
	cnt = cnt + s.count('C')
print(cnt)
for bn in range(0, len(l)):
	print(l[bn])


n = int(input())
c = 0
if n % 2 != 0:
	e = (n - 1) // 2
	o = n - e
	c += (n - 1) // 2 * e
	c += (n + 1) // 2 * o
else:
	e = n // 2
	o = n - e
	c += n // 2 * (e + o)
print(c)
for i in range(1, n + 1):
	if i % 2 != 0 and n % 2 != 0:
		print('C.' * (n // 2) + 'C')
	elif i % 2 != 0 and n % 2 == 0:
		print('C.' * (n // 2))
	elif i % 2 == 0 and n % 2 != 0:
		print('.C' * (n // 2) + '.')
	elif i % 2 == 0 and n % 2 == 0:
		print('.C' * (n // 2))


def main():
	n = int(input())
	if n % 2 == 1:
		print((n // 2 + 1) ** 2 + (n // 2) ** 2)
		for i in range(n):
			if i % 2 == 0:
				print('C.' * (n // 2) + 'C')
			else:
				print('.C' * (n // 2) + '.')
	else:
		print(n // 2 * n)
		for i in range(n):
			if i % 2 == 0:
				print('C.' * (n // 2))
			else:
				print('.C' * (n // 2))
main()


n = int(input())
if n % 2 == 0:
	print(int(n / 2) * n)
elif n % 2 == 1:
	if n == 3:
		print(5)
	else:
		d = (n // 2 + 1) * (n // 2 + 1)
		e = (n - (n // 2 + 1)) * (n - (n // 2 + 1))
		print(d + e)
for i in range(n):
	if i % 2 == 0:
		if n % 2 == 0:
			print('C.' * int(n / 2))
		else:
			print('C.' * int((n - 1) / 2), end='')
			print('C')
	elif n % 2 == 0:
		print('.C' * int(n / 2))
	else:
		print('.C' * int((n - 1) / 2), end='')
		print('.')


import collections
n = int(input())
matrix = []
for k in range(n):
	string = ''
	if k % 2 == 0:
		for i in range(n):
			if i % 2 == 0:
				string += 'C'
			else:
				string += '.'
	else:
		for i in range(n):
			if i % 2 == 0:
				string += '.'
			else:
				string += 'C'
	matrix.append(string)
bstring = ''.join(matrix)
print(collections.Counter(bstring)['C'])
for item in matrix:
	print(item, end='\n')


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	grid = []
	for i in range(n):
		temp = []
		for j in range(n):
			if i % 2 == 0:
				if j % 2 == 0:
					temp.append('C')
				else:
					temp.append('.')
			elif j % 2 == 0:
				temp.append('.')
			else:
				temp.append('C')
		grid.append(temp)
	if n % 2 == 1:
		print(n * n // 2 + 1)
	else:
		print(n * n // 2)
	for i in range(n):
		print(''.join(grid[i]))
testcase(1)


n = int(input())
if n % 2 == 0:
	print(int(n * n / 2))
else:
	print(int(n * n / 2 + 1 / 2))
even_row = str()
odd_row = str()
for j in range(n):
	if j % 2 == 0:
		even_row += 'C'
		odd_row += '.'
	else:
		even_row += '.'
		odd_row += 'C'
for i in range(n):
	if i % 2 == 0:
		print(even_row)
	else:
		print(odd_row)


chessboard = input()
chessboard = int(chessboard)
if chessboard % 2 == 0:
	print(int(chessboard ** 2 / 2))
else:
	print(int((chessboard ** 2 + 1) / 2))
for i in range(0, chessboard):
	if i % 2 == 0:
		c_list = list((chessboard + 1) // 2 * 'C')
		c_list = '.'.join(c_list)
		if chessboard % 2 == 0:
			print(c_list, end='.')
			print('')
		else:
			print(c_list)
	else:
		c_list = list((chessboard + 1) // 2 * '.')
		c_list = 'C'.join(c_list)
		if chessboard % 2 == 0:
			print(c_list, end='C')
			print('')
		else:
			print(c_list)


from math import ceil

def main():
	n = int(input())
	print(int(ceil(n * n / 2)))
	for i in range(n):
		s = ''
		x = 0
		for j in range(n):
			if (i + j) % 2 == 0:
				x += 1
				s += 'C'
			else:
				s += '.'
		print(s)
	pass
main()


x = int(input())
if x % 2 == 0:
	print(int(x / 2 * x))
	for i in range(int(x / 2)):
		print('C.' * (x - int(x / 2)))
		print('.C' * (x - int(x / 2)))
if x % 2 != 0:
	print(int((x + 1) / 2) * x - int(x / 2))
	for i in range(x):
		if i % 2 == 0:
			a = 'C.' * (x - int(x / 2))
			a = list(a)
			del a[-1]
			print(''.join(a))
		else:
			b = '.C' * (x - int(x / 2))
			b = list(b)
			del b[-1]
			print(''.join(b))


import itertools as ittls
from collections import Counter
import string

def sqr(x):
	return x * x

def inputarray(func=int):
	return map(func, input().split())
N = int(input())
print((sqr(N) + 1) // 2)
for i in range(N):
	if i & 1:
		s = '.C' * (N // 2)
		if N & 1:
			s = s + '.'
	else:
		s = 'C.' * (N // 2)
		if N & 1:
			s = s + 'C'
	print(s)


import math
n = int(input())
a = math.ceil(n / 2)
b = math.floor(n / 2)
c = 0
for x in range(n):
	if x % 2 == 0:
		c += a
	else:
		c += b
print(c)
a = ''
b = ''
for x in range(n):
	if x % 2 == 0:
		a += 'C'
		b += '.'
	else:
		a += '.'
		b += 'C'
for x in range(n):
	if x % 2 == 0:
		print(a)
	else:
		print(b)


n = int(input())
print((n * n + 1) // 2)
on = 'C.' * (n // 2) + ('C' if n % 2 else '')
off = '.C' * (n // 2) + ('.' if n % 2 else '')
for i in range(n):
	if i % 2:
		print(off)
	else:
		print(on)


n = int(input())
l = []
c = 0
for i in range(1, n + 1):
	for j in range(1, n + 1):
		if i % 2 == 1:
			if j % 2 == 1:
				l.append('C')
				c += 1
			else:
				l.append('.')
		elif j % 2 == 1:
			l.append('.')
		else:
			l.append('C')
			c += 1
print(c)
s = ''.join(l)
for i in range(0, len(l), n):
	t = slice(0 + i, n + i)
	print(s[t])


a = int(input())
if a % 2 == 1:
	print(a * a // 2 + 1)
else:
	print(a * a // 2)
ch = ['C', '.']
fs = [' '] * a
ss = [' '] * a
for i in range(a):
	fs[i] = ch[i % 2]
for i in range(a):
	ss[i] = ch[(i + 1) % 2]
fs = ''.join(fs)
ss = ''.join(ss)
for i in range(a):
	if i % 2 == 0:
		print(fs)
	else:
		print(ss)


n = int(input())
s = []
sum = 0
for i in range(n):
	s1 = ''
	if i % 2 != 0:
		for j in range(n):
			if j % 2 != 0:
				s1 += 'C'
				sum += 1
			else:
				s1 += '.'
		s.append(s1)
	else:
		for j in range(n):
			if j % 2 == 0:
				s1 += 'C'
				sum += 1
			else:
				s1 += '.'
		s.append(s1)
print(sum)
for i in range(n):
	print(s[i])


n = int(input())
l = []
for i in range(n):
	l.append([0 for i in range(n)])
ans = 0
for i in range(n):
	if i % 2 == 0:
		for j in range(n):
			if j % 2 == 0:
				l[i][j] = 'C'
				ans += 1
			else:
				l[i][j] = '.'
	else:
		for j in range(n):
			if j % 2 == 0:
				l[i][j] = '.'
			else:
				l[i][j] = 'C'
				ans += 1
print(ans)
for k in range(n):
	print(''.join(l[k]))


n = int(input())
board = [['.' for r in range(n)] for c in range(n)]
count = 0
for i in range(n):
	for c in range(i % 2, n, 2):
		board[i][c] = 'C'
		count += 1
print(count)
for row in board:
	print(''.join(row))


n = int(input())
res = ''
for i in range(n):
	if i & 1:
		res += '.C' * (n // 2) + '.' * (n & 1)
	else:
		res += 'C.' * (n // 2) + 'C' * (n & 1)
	res += '\n'
print(res.count('C'))
print(res)


from math import *
a = int(input())
mes = ''
v = 0
for i in range(a):
	for g in range(a):
		if g % 2 == i % 2:
			mes = mes + 'C'
			v += 1
		if g % 2 != i % 2:
			mes = mes + '.'
		g += 1
	mes = mes + '\n'
	i += 1
print(str(v) + '\n' + str(mes))


n = int(input().strip())
print(n ** 2 // 2 + n ** 2 % 2)
if n % 2 == 0:
	N = 1
	ja = ''
	for i in range(n):
		if N == 1:
			ja = ja + 'C'
			N = 0
		else:
			ja = ja + '.'
			N = 1
	javob = ''
	for i in range(n):
		if i % 2 == 0:
			javob = javob + ja + '\n'
		else:
			javob = javob + ja[-1::-1] + '\n'
	print(javob)
else:
	l1 = ''
	l2 = ''
	N = 1
	for i in range(2):
		for j in range(n):
			if i == 1:
				if N == 1:
					l1 = l1 + 'C'
					N = 0
				else:
					N = 1
					l1 = l1 + '.'
			elif N == 1:
				l2 = l2 + 'C'
				N = 0
			else:
				N = 1
				l2 = l2 + '.'
	javob = ''
	for i in range(n):
		if i % 2 == 0:
			javob = javob + l2 + '\n'
		elif i % 2 == 1:
			javob = javob + l1 + '\n'
	print(javob)


from sys import stdin, stdout
input = stdin.readline
n = int(input())
stdout.write(str(n * n // 2 + n % 2) + '\n')
brd = [['.'] * n for i in range(n)]
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			brd[i][j] = 'C'
for ln in brd:
	stdout.write(''.join(ln) + '\n')


n = int(input())
if n % 2 == 0:
	print(n * n // 2)
	print('\n'.join([('C.' if i % 2 == 0 else '.C') * (n // 2) for i in range(n)]))
else:
	p = n // 2
	q = (n + 1) // 2
	print(p * p + q * q)
	print('\n'.join(['C.' * p + 'C' if i % 2 == 0 else '.C' * p + '.' for i in range(n)]))


n = int(input())
A = []
c = 0
for i in range(1, n + 1):
	X = []
	if i % 2 != 0:
		for j in range(1, n + 1):
			if j % 2 != 0:
				X.append('C')
				c = c + 1
			if j % 2 == 0:
				X.append('.')
	if i % 2 == 0:
		for j in range(1, n + 1):
			if j % 2 != 0:
				X.append('.')
			if j % 2 == 0:
				X.append('C')
				c = c + 1
	A.append(X)
print(c)
for k in range(n):
	print(''.join((str(v) for v in A[k])))


n = int(input())
ans = ((n + 1) // 2) ** 2 + (n // 2) ** 2
str1 = ['C' if i % 2 == 0 else '.' for i in range(n)]
str2 = ['.' if i % 2 == 0 else 'C' for i in range(n)]
print(ans, end='\n')
str1 = ''.join(str1)
str2 = ''.join(str2)
for i in range(n):
	if i % 2 == 0:
		print(str1)
	else:
		print(str2)


import sys

def solution():
	number = int(input())
	if number % 2 == 0:
		print(number * number // 2)
	else:
		print(number * number // 2 + 1)
	for i in range(number):
		row = ''
		if i % 2 == 0:
			first = 'C'
			second = '.'
		else:
			first = '.'
			second = 'C'
		for j in range(number):
			if j % 2 == 0:
				row += first
			else:
				row += second
		print(row)
solution()


n = int(input())
if n % 2 == 0:
	print(n * n // 2)
	for i in range(n // 2):
		print('.C' * (n // 2))
		print('C.' * (n // 2))
else:
	print(n * (n // 2) + n // 2 + 1)
	for i in range(n):
		if i % 2 == 0:
			x = ['C'] * (n // 2 + 1)
			print(*x, sep='.')
		else:
			x = ['.'] * (n // 2 + 1)
			print(*x, sep='C')


n = int(input())
if n % 2 == 0:
	print(n ** 2 // 2)
else:
	print(n ** 2 // 2 + 1)
for f in range(n):
	c = ''
	for i in range(n):
		if f % 2 == 0:
			if i % 2 == 0:
				c += 'C'
			else:
				c += '.'
		elif i % 2 == 1:
			c += 'C'
		else:
			c += '.'
	print(c)


n = int(input())
s = ''
c = 0
for x in range(n):
	for y in range(n):
		if x % 2 == 0 and y % 2 == 0 or (x % 2 == 1 and y % 2 == 1):
			s += 'C'
			c += 1
		else:
			s += '.'
	s += '\n'
print(c)
print(s)


def is_valid(i, j, n):
	return i >= 0 and i <= n - 1 and (j >= 0) and (j <= n - 1)
n = int(input())
board = [['C' for i in range(n)] for i in range(n)]
ans = 0
mp = {}
mp['C'] = 0
mp['.'] = 0
print((n * n + 1) // 2)
for i in range(n):
	if i % 2 == 1:
		print('.C' * (n // 2) + '.' * (n % 2))
	else:
		print('C.' * (n // 2) + 'C' * (n % 2))


n = int(input())
ans = 0
if n % 2 == 0:
	print(n // 2 * n)
else:
	print((n // 2 + 1) * (n // 2 + 1) + n // 2 * (n // 2))
for i in range(n):
	s = ''
	for j in range(n):
		if j % 2 == 0 and i % 2 == 0 or (j % 2 == 1 and i % 2 == 1):
			s += 'C'
		else:
			s += '.'
	print(s)


import math
N = int(input())
WTF = [[0 for _ in range(N)] for __ in range(N)]
T = ['C', '.']
LOL = []
for _ in range(N + 1):
	LOL.append(T[_ % 2])
C = 2
print(math.ceil(N / 2) * N if N % 2 == 0 else math.ceil(N / 2) * N - math.floor(N / 2))
for _ in range(N):
	if C % 2 == 0:
		print(''.join(LOL[0:len(LOL) - 1]))
	else:
		print(''.join(LOL[1:len(LOL)]))
	C += 1


n = int(input())
s1 = []
for i in range(n):
	if i % 2 == 0:
		s1.append('C')
	else:
		s1.append('.')
s2 = []
for i in range(n):
	if i % 2 == 1:
		s2.append('C')
	else:
		s2.append('.')
print((n * n + 1) // 2)
for i in range(n):
	if i % 2 == 0:
		print(''.join(s1))
	else:
		print(''.join(s2))


import math

def solve():
	n = int(input())
	print(math.ceil(n * n / 2))
	pattern = 'C.' * 501
	for i in range(n):
		offs = i & 1
		print(pattern[offs:n + offs])
solve()


def get_int():
	return map(int, input().split())
n = int(input())
s1 = 'C.' * (n // 2) + ['', 'C'][n % 2]
s2 = '.C' * (n // 2) + ['', '.'][n % 2]
x = [(n // 2 + 1) ** 2 + (n // 2) ** 2, n * n // 2][n % 2 == 0]
a = [[s1, s2][i % 2] for i in range(n)]
print(x)
for i in a:
	print(i)


n = int(input())
l = [['.' for i in range(n)] for j in range(n)]
c = 0
for i in range(n):
	for j in range(n):
		if i % 2 == 0:
			if j % 2 == 0:
				l[i][j] = 'C'
				c += 1
		elif j % 2 != 0:
			l[i][j] = 'C'
			c += 1
print(c)
for i in range(n):
	s = ''.join(l[i])
	print(s)


import sys
from math import sqrt, floor, factorial
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	n = int(inp())
	print([n * (n // 2), n * (n // 2 + 1) - n // 2][n % 2])
	for i in range(n):
		print(('C.' * (n // 2 + 1))[i % 2:i % 2 + n])
solve()


n = int(input())
output = 0
text = []
if n % 2 == 0:
	is_c = False
	c_first = True
	string = ''
	for i in range(n):
		if c_first:
			is_c = not is_c
		for j in range(n):
			if is_c:
				string += 'C'
				output += 1
			else:
				string += '.'
			is_c = not is_c
			c_first = not c_first
		text.append(string)
		string = ''
else:
	is_c = True
	string = ''
	for i in range(n):
		for j in range(n):
			if is_c:
				string += 'C'
				output += 1
			else:
				string += '.'
			is_c = not is_c
		text.append(string)
		string = ''
print(output)
print('\n'.join(text))


n = int(input())
print(n * n - n * n // 2)
st = '.' * n
for i in range(n):
	if i % 2:
		st = st[:i] + 'C' + st[i + 1:]
st2 = 'C' + st[:-1]
for i in range(n):
	if i % 2:
		print(st)
	else:
		print(st2)


n = int(input())
val = temp = 0
arr = [[val for i in range(n)] for j in range(n)]
for i in range(n):
	for j in range(n):
		if i % 2 == 1 and j % 2 == 1:
			arr[i][j] = 'C'
			temp += 1
			continue
		if i % 2 == 0 and j % 2 == 0:
			arr[i][j] = 'C'
			temp += 1
			continue
		else:
			arr[i][j] = '.'
print(temp)
for i in range(n):
	for j in range(n):
		print(arr[i][j], end='')
	print('')


from math import ceil as c
n = int(input())
print(c(n * n / 2))
for i in range(n):
	for j in range(n):
		if i & 1:
			if j & 1:
				print('C', end='')
			else:
				print('.', end='')
		elif j & 1:
			print('.', end='')
		else:
			print('C', end='')
	print()


n = int(input())
string = ''
for line in range(n):
	if line % 2 == 0:
		sub = ''
		for i in range(1, 1 + n):
			if i % 2 != 0:
				sub += 'C'
			else:
				sub += '.'
		else:
			string += sub + '\n'
	else:
		sub = ''
		for i in range(1, n + 1):
			if i % 2 != 0:
				sub += '.'
			else:
				sub += 'C'
		else:
			string += sub + '\n'
print(string.count('C'))
print(string)


n = int(input())
lst = []

def newlst(l):
	newl = []
	for ch in l:
		if ch == '.':
			newl.append('C')
		else:
			newl.append('.')
	return newl
for i in range(1, n + 1):
	if i % 2 == 0:
		lst.append('.')
	else:
		lst.append('C')
if n % 2 == 0:
	print(int(n * n / 2))
else:
	print((int(n / 2) + 1) ** 2 + int(n / 2) ** 2)
print(''.join(map(str, lst)))
for i in range(n - 1):
	lst = newlst(lst)
	print(''.join(map(str, lst)))


import math

def coder(n):
	cant = math.ceil(n ** 2 / 2)
	m = list()
	for i in range(n):
		if n % 2 == 0 and i % 2 == 0:
			m.append('C.' * (n // 2))
		elif n % 2 == 0 and i % 2 != 0:
			m.append('.C' * (n // 2))
		elif n % 2 != 0 and i % 2 == 0:
			m.append('C.' * (n // 2) + 'C')
		elif n % 2 != 0 and i % 2 != 0:
			m.append('.C' * (n // 2) + '.')
	return [cant, m]
n = int(input().strip())
r = coder(n)
print(r[0])
for i in range(n):
	print(r[1][i])


import math
n = int(input())
print(math.ceil(n / 2) ** 2 + (n // 2) ** 2)
k = '.' * n
p = '.' * n
h = 1
for i in range(n):
	if i % 2 != 0:
		k = k[:i] + 'C' + k[i + 1:]
	else:
		p = p[:i] + 'C' + p[i + 1:]
while h <= n:
	print(p if h % 2 else k)
	h += 1


n = int(input())
a = 'C.'
b = '.C'
lst = []
for i in range(1, n + 1):
	if i % 2 != 0:
		s = a * n
		w = s[:n]
		lst.append(w)
	else:
		s = b * n
		w = s[:n]
		lst.append(w)
if n % 2 == 0:
	v = n * n // 2
else:
	v = n * n // 2 + 1
print(v)
for j in lst:
	print(j)


def main():
	n = int(input())
	r = ((n + 1) // 2) ** 2 + (n // 2) ** 2
	print(r)
	s1 = []
	s2 = []
	for i in range(1, n + 1):
		if i % 2 == 1:
			s1.append('C')
			s2.append('.')
		else:
			s1.append('.')
			s2.append('C')
	s1 = ''.join(s1)
	s2 = ''.join(s2)
	for i in range(1, n + 1):
		print(i % 2 == 1 and s1 or s2)
main()


from math import ceil, trunc
n = int(input())
k1 = 0
line1 = []
b = True
for i in range(n):
	line1.append('C' if b else '.')
	k1 += b
	b = not b
line1 = ''.join(line1)
k2 = 0
line2 = []
b = False
for i in range(n):
	line2.append('C' if b else '.')
	k2 += b
	b = not b
line2 = ''.join(line2)
print(ceil(n / 2) * k1 + trunc(n / 2) * k2)
b = True
for i in range(n):
	print(line1 if b else line2)
	b = not b


N = int(input())
print((N ** 2 + 1) // 2)
for i in range(N):
	print(''.join(['C' if not (i + j) % 2 else '.' for j in range(N)]))


n = int(input())
m = ''
for i in range(n):
	for j in range(n):
		if i % 2 == 0 and j % 2 == 0:
			m += 'C'
		elif i % 2 != 0 and j % 2 != 0:
			m += 'C'
		else:
			m += '.'
	m += '\n'
print(int(n * n / 2 + n * n % 2))
print(m)


n = int(input())
if n % 2 == 0:
	print(n * (n // 2))
else:
	halfN = n // 2
	print((halfN + 1) * (halfN + 1) + halfN * halfN)
for i in range(n):
	result = ''
	isEven = i % 2 == 0
	for j in range(n):
		if isEven:
			if j % 2 == 0:
				result += 'C'
			else:
				result += '.'
		elif j % 2 == 0:
			result += '.'
		else:
			result += 'C'
	print(result)


n = int(input())
l = []
n1 = 0
l1 = ['.'] * n
l2 = ['.'] * n
n2 = 0
n3 = 0
for i in range(n):
	if i % 2 == 0:
		l1[i] = 'C'
		n1 += 1
for i in range(n):
	if i % 2 != 0:
		l2[i] = 'C'
		n2 += 1
for i in range(n):
	if i % 2 == 0:
		l.append(l1)
		n3 += n1
	else:
		l.append(l2)
		n3 += n2
print(n3)
print('\n'.join(map(lambda xs: ''.join(map(str, xs)), l)))


import math
n = int(input())
c = ['C', '.']
f = ''.join([c[x & 1] for x in range(n)])
s = ''.join([c[not x & 1] for x in range(n)])
q = [f, s]
print((math.trunc(n / 2) + 1) ** 2 + (n >> 1) ** 2 if n & 1 else n * (n >> 1))
print(''.join([str(q[x & 1]) + '\n' for x in range(n)]))


def read_string():
	return input()

def read_strings(return_type=iter, split=None, skip=0):
	return return_type(input().split(split)[skip:])

def read_lines(height, return_type=iter):
	return return_type((read_string() for i in range(height)))

def read_number():
	return int(input())

def read_numbers(return_type=iter, skip=0):
	return return_type((int(i) for i in input().split()[skip:]))

def read_values(*types, array=None):
	line = input().split()
	result = []
	for (return_type, i) in zip(types, range(len(types))):
		result.append(return_type(line[i]))
	if array != None:
		(array_type, array_contained) = array
		result.append(array_type((array_contained(i) for i in line[len(types):])))
	return result

def read_array(item_type=int, return_type=iter, skip=0):
	return return_type((item_type(i) for i in input().split()[skip:]))

def read_martix(height, **args):
	return_type = args['return_type'] if 'return_type' in args else iter
	return_type_inner = args['return_type_inner'] if 'return_type_inner' in args else return_type
	return_type_outer = args['return_type_outer'] if 'return_type_outer' in args else return_type
	item_type = args['item_type'] if 'item_type' in args else int
	return return_type_outer((read_array(item_type=item_type, return_type=return_type_inner) for i in range(height)))

def read_martix_linear(width, skip=0, item_type=int, skiped=None):
	num = read_array(item_type=item_type, skip=skip)
	height = len(num) / width
	return [num[i * width:(i + 1) * width] for i in range(height)]

def main():
	n = read_number()
	print((n * n + 1) // 2)
	for i in range(n):
		if i % 2 == 0:
			print(('C.' * n)[0:n])
		else:
			print(('.C' * n)[0:n])
main()


n = int(input())
k = n // 2
if n % 2 == 0:
	print(n * k)
	for x in range(k):
		print('C.' * k)
		print('.C' * k)
else:
	print((n + 1) * k + 1)
	for x in range(k):
		print('C.' * k + 'C')
		print('.C' * k + '.')
	print('C.' * k + 'C')


n = int(input())
if n % 2 == 1:
	k = n // 2
	print(n * n // 2 + 1)
	for i in range(n // 2):
		print('C.' * k + 'C')
		print('.C' * k + '.')
	print('C.' * k + 'C')
else:
	k = n // 2
	print(n * n // 2)
	for i in range(n // 2):
		print('C.' * k)
		print('.C' * k)


grid = []
n = int(input())
cnt = 0
for i in range(n):
	grid.append([])
	for j in range(n):
		if (i + j) % 2 == 0:
			cnt += 1
			grid[i].append('C')
		else:
			grid[i].append('.')
print(cnt)
for i in range(n):
	ans = ''.join(grid[i])
	print(ans)


n = int(input())
print((n * n + 1) // 2)
ret = ['C.' * (n // 2) + ('C' if n % 2 == 1 else '')]
ret.append('.C' * (n // 2) + ('.' if n % 2 == 1 else ''))
for i in range(n):
	print(ret[i % 2])


n = int(input())
f = 0
lst = []
s = ''
cnt = 0
for i in range(n):
	for j in range(n):
		if i % 2:
			if f:
				s += 'C'
				f = 0
				cnt += 1
			else:
				s += '.'
				f = 1
		elif f:
			s += '.'
			f = 0
		else:
			s += 'C'
			f = 1
			cnt += 1
	f = 0
	lst.append(s)
	s = ''
print(cnt)
for i in range(n):
	print(lst[i])


a = int(input())
if a == 1:
	print(1)
	print('C')
elif a % 2 != 0:
	print((pow(a, 2) + 1) // 2)
	for i in range(a):
		if i % 2 == 0:
			print('C.' * (a // 2) + 'C')
		else:
			print('.C' * (a // 2) + '.')
else:
	print(pow(a, 2) // 2)
	for i in range(a):
		if i % 2 == 0:
			print('C.' * (a // 2))
		else:
			print('.C' * (a // 2))


import math
n = int(input())
if n & 1 == 0:
	total_coder = int(n * n / 2)
	print(total_coder)
else:
	total_coder = int(math.ceil(n * n / 2))
	print(total_coder)
for i in range(n):
	if i & 1 == 0:
		for_even_place = 'C.'
		z = math.ceil(n / 2)
		final_string = for_even_place * z
		print(final_string[0:n])
	else:
		for_odd_place = '.C'
		z = math.ceil(n / 2)
		final_string = for_odd_place * z
		print(final_string[0:n])


(s1, s2) = ('', '')
n = int(input())
if n % 2 == 0:
	print(int(n / 2 * n))
	for y in range(int(n / 2)):
		s1 += 'C.'
		s2 += '.C'
	for x in range(int(n / 2)):
		print(s1)
		print(s2)
if n % 2 != 0:
	x = int(n / 2 + 1)
	print(x * x + (x - 1) * (x - 1))
	for y in range(int(n / 2)):
		s1 += 'C.'
		s2 += '.C'
	for z in range(int(n / 2)):
		print(s1 + 'C')
		print(s2 + '.')
	print(s1 + 'C')


n = int(input())
f = [['.' for i in range(n)] for j in range(n)]
print
result = 0
for i in range(0, n, 2):
	pos = i
	for j in range(0, n - i):
		f[j][i + j] = 'C'
		f[i + j][j] = 'C'
		result += 2
result -= n
print(result)
for l in f:
	print(''.join(l))


n = int(input())
c = 0
ans = []
for i in range(n):
	temp = []
	for j in range(n):
		if i % 2 == 0:
			if j % 2 == 0:
				temp.append('C')
				c += 1
			else:
				temp.append('.')
		elif j % 2 == 0:
			temp.append('.')
		else:
			temp.append('C')
			c += 1
	ans.append(temp)
print(c)
for x in ans:
	print(*x, sep='')


import math as ma
x = int(input())
print(ma.ceil(x / 2) ** 2 + ma.floor(x / 2) ** 2)
s1 = ''
s2 = ''
for n in range(x):
	if n % 2 == 0:
		s1 += 'C'
		s2 += '.'
	else:
		s1 += '.'
		s2 += 'C'
for n in range(x):
	if n % 2 == 0:
		print(s1)
	else:
		print(s2)


a = int(input())
(z, b) = (0, [])
for i in range(a):
	v = []
	for j in range(a):
		if i % 2 == 0:
			if j % 2 == 0:
				v.append('C')
				z += 1
			else:
				v.append('.')
		elif j % 2 == 0:
			v.append('.')
		else:
			v.append('C')
			z += 1
	b.append(v)
print(z)
for i in b:
	print(''.join(i))


n = int(input())
a = []
for i in range(n):
	var = []
	if i % 2 == 0:
		for i in range(n):
			if i % 2 == 0:
				var.append('C')
			else:
				var.append('.')
	else:
		for i in range(n):
			if i % 2:
				var.append('C')
			else:
				var.append('.')
	a.append(var)
print(n ** 2 // 2) if n % 2 == 0 else print(n ** 2 // 2 + 1)
for i in a:
	print(''.join(i))


x = int(input())
if x % 2 == 1:
	y = x * x // 2 + 1
else:
	y = x * x // 2
print(y)
j = ''
k = ''
for i in range(1, x + 1):
	if i % 2 == 1:
		j += 'C'
	else:
		j += '.'
for i in range(1, x + 1):
	if i % 2 == 1:
		k += '.'
	else:
		k += 'C'
for i in range(1, x + 1):
	if i % 2 == 1:
		print(j)
	else:
		print(k)


x = int(input())
p = ['C' for i in range((x + 1) // 2)]
q = p.copy()
q.pop()
if x % 2 == 0:
	print(x // 2 * x)
	for i in range(x // 2):
		print('.'.join(p) + '.')
		print('.' + '.'.join(p))
else:
	print((x + 1) // 2 * x - x // 2)
	for i in range(x // 2):
		print('.'.join(p))
		print('.' + '.'.join(q) + '.')
	print('.'.join(p))


n = int(input())
s = ''
count = 0
flag = 0
for j in range(n):
	for i in range(n):
		if flag == 1:
			if i % 2 == 0:
				s = s + '.'
			else:
				count += 1
				s = s + 'C'
		elif i % 2 == 0:
			count += 1
			s = s + 'C'
		else:
			s = s + '.'
	if j != n - 1:
		s = s + '\n'
	if j % 2 != 0:
		flag = 0
	else:
		flag = 1
print(count)
print(s)


n = int(input())
a = []
t = 0
for i in range(1, n + 1):
	a.append([])
	for j in range(1, n + 1):
		if (i + j) % 2 == 0:
			a[len(a) - 1].append('C')
			t += 1
		else:
			a[len(a) - 1].append('.')
print(t)
for k in a:
	print(''.join(k))


a = int(input())
if a % 2 == 0:
	nc = a // 2 * a
else:
	nc = (a // 2) ** 2 + (a // 2 + 1) ** 2
s = ''
print(nc)
for i in range(a):
	if i % 2 == 0:
		for j in range(a):
			if j % 2 == 0:
				s = s + 'C'
			else:
				s = s + '.'
	else:
		for j in range(a):
			if j % 2 == 0:
				s = s + '.'
			else:
				s = s + 'C'
	print(s)
	s = ''


def CreateBoard(n):
	mat = []
	for i in range(n):
		if i % 2 == 0:
			if n % 2 == 0:
				mat.append('C.' * (n // 2))
			else:
				mat.append('C.' * (n // 2 + 1))
		elif n % 2 == 0:
			mat.append('.C' * (n // 2))
		else:
			mat.append('.C' * (n // 2 + 1))
	return mat
n = int(input())
if n % 2 == 0:
	print(n * n // 2)
	for row in CreateBoard(n):
		print(row)
else:
	print((n // 2 + 1) ** 2 + (n // 2) ** 2)
	for row in CreateBoard(n):
		print(row[:-1])


import math
n = int(input())
print(math.ceil(n / 2) ** 2 + (n // 2) ** 2)
for h in range(1, n + 1):
	print(*(['.C' * (n // 2) + ('.' if n % 2 else '')] if h % 2 == 0 else ['C.' * (n // 2) + ('C' if n % 2 else '')]))


from math import ceil
n = int(input())
print(ceil(n * n / 2))
line = 'C.' * int(ceil(n / 2))
i = 0
while i < n:
	if i % 2 == 0:
		print([line, line[:n]][n % 2 == 1])
	else:
		print([line[::-1], line[::-1][:n]][n % 2 == 1])
	i += 1


import math
n = int(input())
print(math.ceil(n ** 2 / 2))
for i in range(n):
	for j in range(n):
		k = i + j
		if k % 2 == 0:
			print('C', end='')
		else:
			print('.', end='')
	print()


n = int(input())
t = 1
l = []
k = 0
for i in range(n):
	S = ''
	if t == 1:
		for j in range(n):
			if (j + 1) % 2 != 0:
				S = S + 'C'
				k = k + 1
			else:
				S = S + '.'
	if t == 2:
		for j in range(n):
			if (j + 1) % 2 == 0:
				S = S + 'C'
				k = k + 1
			else:
				S = S + '.'
	if t == 1:
		t = 2
	else:
		t = 1
	l.append(S)
print(k)
for i in range(n):
	print(l[i])


n = int(input())
(r, l) = (0, ['', ''])
for i in range(n):
	r += n // 2 + n % 2 * (1 - i % 2)
	l[0] += 'C' if i % 2 == 0 else '.'
	l[1] += 'C' if i % 2 == 1 else '.'
print(r)
s = l[0]
for i in range(1, n):
	s += '\n' + l[i % 2]
print(s)


n = int(input())
s = ''
for i in range(n + 1):
	if i % 2 == 0:
		s += 'C'
	else:
		s += '.'
ss = []
ans = 0
for i in range(n):
	if i % 2 == 0:
		ss.append(s[0:n])
		ans += s[0:n].count('C')
	else:
		ss.append(s[1:n + 1])
		ans += s[1:n + 1].count('C')
print(ans)
for i in ss:
	print(i)


a = int(input(''))
result = []
for i in range(a):
	result.append(['.'] * a)
fs = 'C'
ss = '.'
for i in range(a - 1):
	if fs[len(fs) - 1] == 'C':
		fs = fs + '.'
	else:
		fs = fs + 'C'
	if ss[len(ss) - 1] == 'C':
		ss = ss + '.'
	else:
		ss = ss + 'C'
temp = 0
if a % 2 == 1:
	print(int((a * a + 1) / 2))
else:
	print(int(a * a / 2))
for i in range(a):
	if temp == 0:
		print(fs)
		temp = 1
	else:
		print(ss)
		temp = 0


n = int(input())
ans = []
for i in range(n):
	k = '.' * (i % 2)
	for j in range(n):
		if j % 2:
			k += '.'
		else:
			k += 'C'
	ans += [''.join(list(k)[:n])]
print(-(-n // 2) * -(-n // 2) + n // 2 * (n // 2))
print('\n'.join(ans))


import time
number = int(input())
tota_no_of_coders = (number + 1) // 2 * ((number + 1) // 2)
tota_no_of_coders = tota_no_of_coders + number // 2 * (number // 2)
print(tota_no_of_coders)

def make_line(number, flag):
	dict = {}
	dict[0] = 'C'
	dict[1] = '.'
	line = ''
	for i in range(number):
		line = ''.join([line, dict[flag]])
		flag = (flag + 1) % 2
	return line
line1 = make_line(number, 0)
line2 = make_line(number, 1)

def print_lines(number, line_number):
	if line_number % 2 == 0:
		eval('print(line1)')
	else:
		eval('print(line2)')
for i in range(number):
	print_lines(number, i)


n = int(input())
if n % 2 == 0:
	res = n * (n // 2)
else:
	res = n * (n // 2) + n // 2 + 1
print(res)
line1 = []
line2 = []
turn = True
for i in range(n):
	if turn:
		line1.append('C')
		line2.append('.')
	else:
		line1.append('.')
		line2.append('C')
	turn = not turn
turn = True
str1 = ''.join(line1)
str2 = ''.join(line2)
for i in range(n):
	if turn:
		print(str1)
	else:
		print(str2)
	turn = not turn


n = int(input())
list1 = []
list2 = []
s = ''
s2 = ''
if n % 2 != 0:
	a = int((n + 1) / 2)
	b = int((n - 1) / 2)
	print(a ** 2 + b ** 2)
	for i in range(2):
		for j in range(n):
			if i == 0:
				if (i + j) % 2 == 0:
					list1.append('C')
				else:
					list1.append('.')
			elif (i + j) % 2 == 0:
				list2.append('C')
			else:
				list2.append('.')
else:
	print(int(n / 2) * n)
	for i in range(2):
		for j in range(n):
			if i == 0:
				if (i + j) % 2 == 0:
					list1.append('C')
				else:
					list1.append('.')
			elif (i + j) % 2 == 0:
				list2.append('C')
			else:
				list2.append('.')
ans1 = s.join(list1)
ans2 = s2.join(list2)
for i in range(n):
	if i % 2 == 0:
		print(ans1)
	else:
		print(ans2)


from sys import stdin

def main():
	n = int(stdin.readline().strip())
	print(n * n // 2 + (n & 1))
	s0 = ('C.' * (n // 2 + 1))[:n]
	s1 = ('.C' * (n // 2 + 1))[:n]
	for i in range(n):
		print((s0, s1)[i & 1])
main()


n = int(input())
l = list()
dot = 0
let = 0
for i in range(0, 1002):
	if i % 2 == 0:
		l.append('C')
	else:
		l.append('.')
if n % 2 == 0:
	dot = int(n / 2)
	let = int(n / 2)
else:
	let = int(n / 2) + 1
	dot = int(n / 2)
print(dot * dot + let * let)
for i in range(0, n):
	if i % 2 == 0:
		print(''.join(l[0:n]))
	else:
		print(''.join(l[1:n + 1]))


n = int(input())
p = True
firstm = ''
secondm = ''
if n % 2 == 0:
	print(int(n * n / 2))
else:
	print(int((n + 1) * (n + 1) / 2 - n))
for i in range(n):
	if i % 2 == 0:
		firstm += 'C'
	else:
		firstm += '.'
if n % 2 == 0:
	secondm = firstm[::-1]
else:
	secondm = firstm[1:] + '.'
for i in range(n):
	print(firstm if i % 2 == 0 else secondm)


n = int(input())
t = ((n + 1) // 2) ** 2 + (n // 2) ** 2
print(t)
print('\n'.join((('.C' * n)[:n] if x % 2 else ('C.' * n)[:n] for x in range(n))))


from collections import *
from math import *
n = int(input())
a = [['.' for i in range(n)] for j in range(n)]
ans = 0
for i in range(n):
	for j in range(n):
		if (i + j) % 2 == 0:
			a[i][j] = 'C'
			ans += 1
print(ans)
for i in range(n):
	print(''.join(a[i]))


s = int(input())
print((s * s + 1) // 2)
for i in range(s):
	print(('C.' * 1000)[i:i + s])


n = input()
full = []
num = 0
for i in range(int(n)):
	line = ''
	for j in range(int(n)):
		if (i + j) % 2 == 1:
			line = line + '.'
		else:
			line = line + 'C'
			num = num + 1
	full.append(line)
print(num)
for hm in full:
	print(hm)


n = int(input())
if n % 2 == 0:
	print(n ** 2 // 2)
elif n % 2 != 0:
	print((n ** 2 + 1) // 2)
a = ''
for i in range(n):
	if i % 2 == 0:
		a += 'C'
	elif i % 2 != 0:
		a += '.'
b = ''
for i in range(n):
	if i % 2 != 0:
		b += 'C'
	elif i % 2 == 0:
		b += '.'
for j in range(n):
	if j % 2 == 0:
		print(a)
	elif j % 2 != 0:
		print(b)


import math
n = int(input())
print(math.ceil(n / 2) * math.ceil(n / 2) + math.floor(n / 2) * math.floor(n / 2))
for i in range(n):
	for j in range(n):
		if i % 2 == 0 and j % 2 == 0 or (i % 2 == 1 and j % 2 == 1):
			print('C', end='')
		else:
			print('.', end='')
	print(end='\n')


n = int(input())
if n % 2 == 0:
	print(n * n // 2)
else:
	print(n // 2 * n + n // 2 + 1)
line1 = 'C.' * (n // 2 + 1)
line2 = '.C' * (n // 2 + 1)
for i in range(n):
	if i % 2 == 0:
		print(line1[:n])
	else:
		print(line2[:n])


from math import ceil
x = int(input())
print(ceil(x * x / 2))
for row in range(x):
	rowCurrent = ''
	for column in range(x):
		if row % 2 == 0 and column % 2 == 0 or (row % 2 == 1 and column % 2 == 1):
			rowCurrent += 'C'
		else:
			rowCurrent += '.'
	print(rowCurrent)


n = int(input())
p = n
l = []
if n % 2 == 0:
	print(n * (n // 2))
else:
	n = n // 2
	print(n * (n + 1) * 2 + 1)
for i in range(p):
	if i % 2 == 0:
		l.append('C')
	elif i % 2 != 0:
		l.append('.')
m = ''.join(map(str, l))
r = m.replace('C', '%temp%').replace('.', 'C').replace('%temp%', '.')
for i in range(p):
	if i % 2 == 0:
		print(m)
	else:
		print(r)


from math import floor, ceil
n = int(input())
li = []
if n % 2 != 0:
	a = ceil(n / 2)
	b = floor(n / 2)
	k = a * (n // 2 + 1) + b * (n // 2)
	print(k)
	l = 0
	s = ''
	for i in range(1, n + 1):
		for j in range(1, n + 1):
			if l == 0:
				if j % 2 != 0:
					s += 'C'
				else:
					s += '.'
			elif j % 2 == 0:
				s += 'C'
			else:
				s += '.'
		if l == 0:
			l = 1
		else:
			l = 0
		li.append(s)
		s = ''
	for i in li:
		print(i)
else:
	k = n * (n // 2)
	l = 0
	print(k)
	s = ''
	for i in range(1, n + 1):
		for j in range(1, n + 1):
			if l == 0:
				if j % 2 != 0:
					s += 'C'
				else:
					s += '.'
			elif j % 2 == 0:
				s += 'C'
			else:
				s += '.'
		if l == 0:
			l = 1
		else:
			l = 0
		li.append(s)
		s = ''
	for i in li:
		print(i)


n = int(input())
matrix = []
for i in range(n):
	if i % 2 == 0:
		row = 'C.' * (n // 2) + 'C' * (1 if n % 2 != 0 else 0)
	else:
		row = '.C' * (n // 2) + '.' * (1 if n % 2 != 0 else 0)
	matrix.append(row)
if n % 2 == 0:
	print(n * (n // 2))
else:
	print(n * (n // 2) + n // 2 + 1)
for j in range(n):
	print(matrix[j])