#include <bits/stdc++.h>
using namespace std;
using namespace rel_ops;
using ll = int64_t;
using Pii = pair<int, int>;
using ull = uint64_t;
using Vi = vector<int>;
void run();
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  run();
  return 0;
}
int uplg(int n) { return 32 - __builtin_clz(n); }
int uplg(ll n) { return 64 - __builtin_clzll(n); }
int cmp(double a, double b, double eps = 1e-9) {
  return (a > b + eps) - (a + eps < b);
}
void run() {
  int n;
  cin >> n;
  Vi perm;
  bool sorted = true;
  for (int i = (0); i < (n); i++) {
    int first;
    cin >> first;
    perm.push_back(first - 1);
    if (first != i + 1) sorted = false;
  }
  vector<string> board(n, string(n, '.'));
  if (sorted) {
    cout << n << '\n';
    for (auto& row : (board)) cout << row << '\n';
    return;
  }
  vector<bool> seen(n);
  int r = 0;
  for (int i = (0); i < (n); i++)
    if (!seen[i]) {
      Vi cycle = {i};
      seen[i] = true;
      for (int j = perm[i]; j != i; j = perm[j]) {
        cycle.push_back(j);
        seen[j] = true;
      }
      if (int((cycle).size()) <= 1) continue;
      ;
      if (i > 0) {
        board[r][0] = board[r][cycle[1]] = '/';
        r++;
      }
      for (int j = (1); j < (int((cycle).size())); j++) {
        int a = cycle[j], b = cycle[(j + 1) % int((cycle).size())];
        board[r][a] = board[r][b] = (a < b ? '/' : '\\');
        r++;
      }
      board[r - 1][0] = '\\';
    }
  cout << n - 1 << '\n';
  for (auto& row : (board)) cout << row << '\n';
}
