// General imports

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

//Correct solution with too much time complexity O(n*n) fails almost every test case to time
public class MaximumAura {
  public static void main(String[] args) throws IOException {

    long t = System.nanoTime();

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);

    // Write code here

    int a = Integer.parseInt(br.readLine());
    int[] input = new int[a];
    int[] left = new int[a];
    int[] right = new int[a];
    left[0] = 1;
    right[a - 1] = 1;
    StringTokenizer st = new StringTokenizer(br.readLine());
    for (int i = 0; i < a; i++) {
      input[i] = Integer.parseInt(st.nextToken());
    }

    for (int i = 1; i < input.length; i++) {
      int max = 0;
      for (int j = 0; j < i; j++) {
        if (input[j] < input[i]) {
          max = Math.max(max, left[j]);
        }
      }
      left[i] = max + 1;
    }

    for (int i = a - 2; i >= 0; i--) {
      right[i] = 1;
      int max = 0;
      for (int j = a - 1; j > i; j--) {
        if (input[j] < input[i]) {
          max = Math.max(max, right[j]);
        }
      }
      right[i] += max;
    }
    PriorityQueue<Integer> p = new PriorityQueue<>();
    for (int i = 0; i < input.length; i++) {
      out.print((left[i] + right[i] - 1) + " ");
    }

    br.close();
    out.flush();

  }
}
