#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  cout << (n * n + 1) / 2 << endl;
  string s[n][n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if ((j % 2 == 0 && i % 2 == 0) || (i % 2 == 1 && j % 2 == 1)) {
        s[i][j] = 'C';
      } else {
        s[i][j] = '.';
      }
      cout << s[i][j];
      if (j == n - 1) {
        cout << endl;
      }
    }
  }
}
