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

Difficulty: interview

Starter code:

Solutions:
n=int(input())
print(n*n//2+n*n%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())

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)


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())
if n%2==0:
    print(n*n//2)
else:
    print(((n+1)//2)**2+(n//2)**2)
for i in range(n):
    c=[]
    for j in range(n):
        if i%2==0:
            if j%2==0:
                c.append('C')
            else:
                c.append('.')
        else:
            if j%2==0:
                c.append('.')
            else:
                c.append('C')
    print(''.join(c))


# -*- coding: utf-8 -*-
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)]))

# -*- coding: utf-8 -*-
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)]
)))


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())
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())
if n % 2 == 0:
    print(n**2 //2)
else:
    print( n ** 2 // 2 + 1)
d = [['.'] * n for i in range(n)]
for i in range(n):
    if i % 2 != 0:
        print('.C' * (n // 2) + '.' * (n % 2))
    else:
        print('C.' * (n // 2) + 'C' * (n % 2))

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
            
def __starting_point():
    main()

__starting_point()

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 + "."
            else:
                if j%2 == 1:
                    ans = ans + "C"
                else:
                    ans = ans + "."
        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())
print((n*n+1)//2)
for i in range(n):	
	print(('C.'*600)[i%2:i%2+n])


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())
print(int((n ** 2 + 1) / 2))
for i in range(n):
    str = '';
    for j in range(n):
        str += ('C', '.')[(i + j) % 2 == 1]
    print(str)


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

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

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

n = int(input())

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



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


def __starting_point():
    main()
__starting_point()

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())
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 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))
        else:
            if 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])

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