#include <bits/stdc++.h>
using namespace std;
int n, i, j, graph[1005][1005], ok = 1, a[1005], b[1005], vis[1005], pos = 0,
                                pre;
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[a[i]] = i;
  }
  for (i = 1; i <= n; i++)
    if (a[i] != i) ok = 0;
  if (!ok) {
    pos = n + 1;
    vis[b[1]] = 1;
    for (i = b[b[1]]; i != b[1]; i = b[i]) {
      vis[i] = 1;
      pos--;
      graph[pos][i] = graph[pos][a[i]] = a[i] - i;
    }
    pos = 0;
    for (i = 1; i <= n; i++) {
      if (!vis[i] && a[i] > i && a[i] != 1) {
        pre = pos + 1;
        for (j = i; !vis[j]; j = a[j]) {
          vis[j] = 1;
          pos++;
          if (!vis[a[j]])
            graph[pos][j] = graph[pos][a[j]] = a[j] - j;
          else {
            graph[pos][j] = graph[pos][1] = a[j] - j;
            graph[pre][1] = j - a[j];
          }
        }
      }
    }
  }
  printf("%d\n", (ok) ? n : n - 1);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= n; j++) {
      if (graph[i][j] > 0) printf("/");
      if (graph[i][j] == 0) printf(".");
      if (graph[i][j] < 0) printf("\\");
    }
    printf("\n");
  }
  return 0;
}
