#include <bits/stdc++.h>
using namespace std;
int N, level;
int Perm[1005], trash, Inv[1005];
char Matrix[1005][1005];
bool Use[1005];
int cnt;
vector<int> Cycle[1005];
int findLast() {
  for (int i = N; i >= 1; i--) {
    if (Perm[i] != i) return i;
  }
  return 0;
}
void initialize() {
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) Matrix[i][j] = '.';
  }
}
void Read() {
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> Perm[i], Inv[Perm[i]] = i;
}
void printMatrix(int res) {
  printf("%d\n", res);
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++) printf("%c", Matrix[i][j]);
    printf("\n");
  }
}
void solveCycle(int c, bool solveLast) {
  int start = 1;
  if (solveLast)
    Matrix[level + 1][trash] = '\\', start = 0;
  else
    Cycle[c].push_back(Cycle[c][0]);
  for (int i = start; i < Cycle[c].size() - 1; i++) {
    int curr = Cycle[c][i], next = Cycle[c][i + 1];
    ++level;
    if (curr < next)
      Matrix[level][curr] = Matrix[level][next] = '/';
    else
      Matrix[level][curr] = Matrix[level][next] = '\\';
  }
  if (solveLast) {
    ++level;
    int last = Cycle[c].back();
    Matrix[level][trash] = Matrix[level][last] = '/';
  }
}
void fillCycle(int start) {
  ++cnt;
  while (Use[start] == 0) {
    Use[start] = 1;
    Cycle[cnt].push_back(start);
    start = Perm[start];
  }
}
void findCycles() {
  for (int i = N; i >= 1; i--) {
    if (Use[i] == 0) {
      fillCycle(i);
    }
  }
}
void getMirrors() {
  trash = findLast();
  if (trash == 0) {
    printMatrix(N);
    return;
  }
  int point = 1;
  while (Cycle[point].size() == 1) ++point;
  solveCycle(point, 0);
  for (int i = point + 1; i <= cnt; i++) {
    if (Cycle[i].size() > 1) {
      solveCycle(i, 1);
    }
  }
  printMatrix(N - 1);
}
int main() {
  Read();
  initialize();
  findCycles();
  getMirrors();
  return 0;
}
