#include <bits/stdc++.h>
using namespace std;
int n;
int perm[1001];
bool seen[1001];
string grid[1001];
vector<vector<int>> cycles;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> perm[i];
    perm[i]--;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      grid[i] += '.';
    }
  }
  for (int i = 0; i < n; i++) {
    if (seen[i]) continue;
    vector<int> cycle;
    int x = i;
    while (!seen[x]) {
      cycle.push_back(x);
      seen[x] = true;
      x = perm[x];
    }
    cycles.push_back(cycle);
  }
  memset(seen, 0, sizeof seen);
  int y = n - 1;
  int forsaken = -1;
  bool isfirst = true;
  int ans = 0;
  for (int i = 0; i < cycles.size(); i++) {
    if (cycles[i].size() == 1) {
      ans++;
      continue;
    }
    if (forsaken == -1) forsaken = cycles[i][0];
    y -= cycles[i].size();
    if (isfirst) y++;
    int leftmost = cycles[i][0];
    int x = leftmost;
    int lastx = -1;
    while (true) {
      int nxt = perm[x];
      assert(nxt != x);
      if (nxt == leftmost) break;
      if (nxt < x) {
        grid[y][x] = '\\';
        grid[y][nxt] = '\\';
      } else {
        grid[y][x] = '/';
        grid[y][nxt] = '/';
      }
      y++;
      x = nxt;
      lastx = x;
      ans++;
    }
    if (!isfirst) {
      grid[y][lastx] = '\\';
      grid[y][forsaken] = '\\';
      grid[y - cycles[i].size() + 1][forsaken] = '/';
      ans++;
    }
    y -= cycles[i].size() - 1;
    isfirst = false;
  }
  cout << ans << endl;
  for (int i = 0; i < n; i++) {
    cout << grid[i] << endl;
  }
}
