#include <bits/stdc++.h>
using namespace std;
int n, c;
int a[1005][1005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      if ((i + j) % 2 == 0)
        a[i][j] = 1;
      else
        a[i][j] = 0;
      if (a[i][j] == 1) c++;
    }
  cout << c << '\n';
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i][j] == 1)
        cout << "C";
      else
        cout << '.';
    }
    cout << '\n';
  }
}
