#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
const long long mod = 1e9 + 7;
const long long N = 5e5;
long long n;
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);
  std::cout.tie(0);
  cin >> n;
  if (n % 2) {
    cout << (n * n + 1) / 2 << "\n";
  } else {
    cout << (n * n) / 2 << "\n";
  }
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= n; ++j) {
      if (!((i + j) % 2)) {
        cout << 'C';
      } else {
        cout << '.';
      }
    }
    cout << "\n";
  }
  return 0;
}
