#include <bits/stdc++.h>
using namespace std;
const int N = 1145;
int fr[N], nt[N], f[N], sz[N];
int n, tt, ct, tp, pp, v[N], as[N][N];
int pd(int i, int j) {
  if (i < j)
    return 2;
  else
    return 3;
}
void dfs(int x) {
  sz[ct]++;
  f[x] = ct;
  if (!f[nt[x]]) dfs(nt[x]);
}
int ycl(int x) {
  if (fr[x] < x && nt[x] < x) {
    return x;
  }
  return ycl(nt[x]);
}
void gz(int x) {
  v[x] = 1;
  if (x == n) {
    return;
  }
  if (!v[nt[x]] || nt[x] == n) {
    if ((as[tt][x] ^ 1) == pd(x, nt[x])) tt--;
    as[tt][x] = as[tt][nt[x]] = pd(x, nt[x]);
    gz(nt[x]);
  } else if (nt[x] != n) {
    if (as[tt][x] == 3) tt--;
    as[tt][x] = 2, as[tt][n] = 2, as[tp][n] = 3, as[tp][nt[x]] = 3;
  }
}
void print(int x) {
  if (!x) printf(".");
  if (x == 2) printf("/");
  if (x == 3) printf("\\");
}
int main() {
  scanf("%d", &n);
  tt = n;
  for (int i = (1); i <= (n); i++) {
    int x;
    scanf("%d", &x);
    nt[i] = x, fr[x] = i;
  }
  for (int i = (1); i <= (n); i++)
    if (!f[i]) ct++, dfs(i);
  if (sz[n] != 1) pp = 1, gz(nt[n]);
  tt--;
  for (int i = (1); i <= (n); i++)
    if (!v[i] && sz[f[i]] != 1) tp = tt, tt--, pp = 1, gz(nt[ycl(i)]), tt--;
  if (!pp)
    printf("%d\n", n);
  else
    printf("%d\n", n - 1);
  for (int i = n; i >= 1; i--) {
    for (int j = (1); j <= (n); j++) print(as[i][j]);
    puts("");
  }
}
