#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> arr(n);
  bool found = false;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    arr[i]--;
    if (arr[i] != i) found = true;
  }
  vector<string> grid(n, string(n, '.'));
  if (!found) {
    cout << n << '\n';
    for (int i = 0; i < n; ++i) {
      cout << grid[i] << '\n';
    }
    return 0;
  }
  vector<bool> visited(n, false);
  vector<vector<int> > cycle;
  for (int i = 0; i < n; ++i) {
    if (visited[i]) continue;
    if (arr[i] == i) continue;
    int curr = i;
    vector<int> temp;
    while (!visited[curr]) {
      temp.push_back(curr);
      visited[curr] = true;
      curr = arr[curr];
    }
    cycle.push_back(temp);
  }
  int gar = 0;
  for (int i = 0; i < n; ++i) {
    if (arr[i] != i) gar = i;
  }
  int row = n - 1;
  for (auto &cyc : cycle) {
    int start = 0;
    int size = cyc.size();
    bool foundGar = false;
    for (int i = 0; i < size; ++i) {
      if (cyc[i] == gar) {
        foundGar = true;
      }
      if (cyc[i] < cyc[(i + 1) % size]) {
        start = i;
      }
    }
    if (foundGar) continue;
    if (foundGar) {
      for (int i = 0; i < size; ++i) {
        if (cyc[i] == gar) {
          start = (i - 1 + size) % size;
        }
      }
    }
    for (int i = start + size, j = 0; j < size; i--, j++) {
      int curr = cyc[i % size];
      int next = cyc[(i + 1) % size];
      if (j == size - 1 && !foundGar) {
        grid[row][gar] = '\\';
        grid[row][next] = '\\';
        row--;
        break;
      }
      if (j != size - 1 || !foundGar) {
        if (curr < next) {
          grid[row][curr] = '/';
          grid[row][next] = '/';
          if (i == start + size && !foundGar) {
            grid[row][gar] = '/';
          }
        } else {
          grid[row][curr] = '\\';
          grid[row][next] = '\\';
        }
        row--;
      }
    }
  }
  for (auto &cyc : cycle) {
    int start = 0;
    int size = cyc.size();
    bool foundGar = false;
    for (int i = 0; i < size; ++i) {
      if (cyc[i] == gar) {
        foundGar = true;
      }
      if (cyc[i] < cyc[(i + 1) % size]) {
        start = i;
      }
    }
    if (!foundGar) continue;
    if (foundGar) {
      for (int i = 0; i < size; ++i) {
        if (cyc[i] == gar) {
          start = (i - 1 + size) % size;
        }
      }
    }
    for (int i = start + size, j = 0; j < size; i--, j++) {
      int curr = cyc[i % size];
      int next = cyc[(i + 1) % size];
      if (j == size - 1 && !foundGar) {
        grid[row][gar] = '\\';
        grid[row][next] = '\\';
        row--;
        break;
      }
      if (j != size - 1 || !foundGar) {
        if (curr < next) {
          grid[row][curr] = '/';
          grid[row][next] = '/';
          if (i == start + size && !foundGar) {
            grid[row][gar] = '/';
          }
        } else {
          grid[row][curr] = '\\';
          grid[row][next] = '\\';
        }
        row--;
      }
    }
  }
  cout << n - 1 << '\n';
  for (int i = 0; i < n; ++i) {
    cout << grid[i] << '\n';
  }
  return 0;
}
