// Arup Guha
// 2/10/2017
// Solution to 2017 January USACO Gold Problem: Balanced Photo

import java.util.*;
import java.io.*;

public class bphoto {

	public static void main(String[] args) throws Exception {

		// Open file.
		BufferedReader stdin = new BufferedReader(new FileReader("bphoto.in"));
		int n = Integer.parseInt(stdin.readLine().trim());

		// Get heights - store in original and sorted order.
		int[] heights = new int[n];
		int[] sorted = new int[n];
		for (int i=0; i<n; i++) {
			heights[i] = Integer.parseInt(stdin.readLine().trim());
			sorted[i] = heights[i];
		}
		Arrays.sort(sorted);

		// Map heights to compressed values.
		HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
		for (int i=0; i<n; i++)
			map.put(sorted[i], i+1);

		// Now, store relative heights.
		for (int i=0; i<n; i++)
			heights[i] = map.get(heights[i]);

		long[] left = new long[n];
		bit myBit = new bit(n+1);

		// Run from left to right using BIT computing # taller on left of i.
		for (int i=0; i<n; i++) {
			left[i] = myBit.above(heights[i]);
			myBit.add(heights[i], 1L);
		}

		long[] right = new long[n];
		myBit = new bit(n+1);

		// Run from right to left using BIT computing # taller on right of i.
		for (int i=n-1; i>=0; i--) {
			right[i] = myBit.above(heights[i]);
			myBit.add(heights[i], 1L);
		}

		// Just calculate what the problem asks for...
		int res = 0;
		for (int i=0; i<n; i++)
			if (right[i] > 2*left[i] || left[i] > 2*right[i])
				res++;

		// Ta da!
		PrintWriter out = new PrintWriter(new FileWriter("bphoto.out"));
		out.println(res);
		out.close();
		stdin.close();
	}
}

class bit {

	public long[] cumfreq;

	// Do indexes 1 to n.
	public bit(int n) {

		int size = 1;
		while (size < n) size <<= 1;
		n = size;

		cumfreq = new long[n+1];
	}

	// Uses 1 based indexing.
	public void add(int index, long value) {
		while (index < cumfreq.length) {
			cumfreq[index] += value;
			index += Integer.lowestOneBit(index);
		}
	}

	// Returns the sum of everything upto index.
	public long sum(int index) {
		long ans = 0;
		while (index > 0) {
			ans += cumfreq[index];
			index -= (Integer.lowestOneBit(index));
		}
		return ans;
	}

	// Use 1 based indexing.
	public long sum(int low, int high) {
		return sum(high) - sum(low-1);
	}

	// Return the total number of items in the BIT.
	public long all() {
		return sum(cumfreq.length-1);
	}

	// Return the total number of items in the BIT at or above index.
	public long above(int index) {
		return all() - sum(index);
	}
}