#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char a[1002][1002];
int ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      if (j % 2 == 0 && i % 2 == 1) {
        a[i][j] = '.';
      } else if (j % 2 == 1 && i % 2 == 1) {
        a[i][j] = 'C';
        ++ans;
      }
      if (j % 2 == 0 && i % 2 == 0) {
        a[i][j] = 'C';
        ++ans;
      } else if (j % 2 == 1 && i % 2 == 0) {
        a[i][j] = '.';
      }
    }
  cout << ans << endl;
  ;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) cout << a[i][j];
    cout << endl;
  }
}
