#include <bits/stdc++.h>
using namespace std;
const long long N = 1e3 + 5, M = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  long long n;
  cin >> n;
  cout << 1 + (n * n - 1) / 2 << "\n";
  for (long long i = 0; i < n; i++, cout << "\n")
    for (long long j = 0; j < n; j++) cout << "C."[(i + j) % 2];
}
