You are given n chips on a number line. The i-th chip is placed at the integer coordinate x_i. Some chips can have equal coordinates.

You can perform each of the two following types of moves any (possibly, zero) number of times on any chip:

  * Move the chip i by 2 to the left or 2 to the right for free (i.e. replace the current coordinate x_i with x_i - 2 or with x_i + 2); 
  * move the chip i by 1 to the left or 1 to the right and pay one coin for this move (i.e. replace the current coordinate x_i with x_i - 1 or with x_i + 1). 



Note that it's allowed to move chips to any integer coordinate, including negative and zero.

Your task is to find the minimum total number of coins required to move all n chips to the same coordinate (i.e. all x_i should be equal after some sequence of moves).

Input

The first line of the input contains one integer n (1 ≤ n ≤ 100) — the number of chips.

The second line of the input contains n integers x_1, x_2, ..., x_n (1 ≤ x_i ≤ 10^9), where x_i is the coordinate of the i-th chip.

Output

Print one integer — the minimum total number of coins required to move all n chips to the same coordinate.

Examples

Input


3
1 2 3


Output


1


Input


5
2 2 2 3 3


Output


2

Note

In the first example you need to move the first chip by 2 to the right and the second chip by 1 to the right or move the third chip by 2 to the left and the second chip by 1 to the left so the answer is 1.

In the second example you need to move two chips with coordinate 3 by 1 to the left so the answer is 2.
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.math.BigInteger;
import java.io.*;
import java.util.*;
public class Main {
	private static Reader fr;
	private static OutputStream out;
	private static final int delta = (int) 1e9 + 7;

	private static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[1024];
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}

		public int[] nextArray(int n) throws IOException {
			int arr[] = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = nextInt();
			}
			return arr;
		}
	}

	private static void print(Object str) {
		try {
			out.write(str.toString().getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private static void println(Object str) {
		try {
			out.write((str.toString() + "\n").getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private static void printArray(int arr[]) {
		for (int val : arr) {
			print(val + " ");
		}
		println("");
	}

	private static long add(long a, long b) {
		return add(a, b, delta);
	}

	private static long add(long a, long b, long mod) {
		return ((a % mod) + (b % mod)) % mod;
	}

	private static long multiply(long a, long b) {
		return ((a % delta) * (b % delta)) % delta;
	}

	public static double multiply(double a, double b) {
		return ((a % delta) * (b % delta)) % delta;
	}

	private static long pow(int base, int pow) {
		if (pow == 0)
			return 1;
		if (pow == 1)
			return base;
		long halfPow = pow(base, pow / 2);
		if ((pow & 1) == 0)
			return multiply(halfPow, halfPow);
		return multiply(halfPow, multiply(base, halfPow));
	}

	private static long gcd(long a, long b) {
		if (a == 0 || b == 0)
			return a == 0 ? b : a;
		return gcd(b, a % b);
	}

	private static long kadane(int[] arr) {
		int size = arr.length;
		long max_so_far = Integer.MIN_VALUE, max_ending_here = 0;

		for (int anArr : arr) {
			max_ending_here = max_ending_here + anArr;
			if (max_so_far < max_ending_here)
				max_so_far = max_ending_here;
			if (max_ending_here < 0)
				max_ending_here = 0;
		}
		return max_so_far;
	}

	public static void main(String args[]) throws IOException {
		run();
	}

	private static void run() throws IOException {
		fr = new Reader();
		out = new BufferedOutputStream(System.out);
		solve();
		out.flush();
		out.close();
	}
	static int mod=1000000007;
	private static void solve() throws IOException 
	{
		int t = 1;//fr.nextInt();
		while (t-- > 0) {
			int n = fr.nextInt();
			int e=0;
			int od=0;
			for(int i=0;i<n;i++)
			    if(fr.nextInt()%2==0)
			        e++;
		        else
		            od++;
            System.out.println(Math.min(e,od));
		}
    }
    static void task0(ArrayList<Integer>[] g ,int a[],long s1[],int n,int s,int p,int x)
    {
        for(int i=0;i<g[s].size();i++)
            if(g[s].get(i)!=p)
                task0(g,a,s1,n,g[s].get(i),s,x);
        s1[s]=(long)a[s];
        for(int i=0;i<g[s].size();i++)
            s1[s]+=s1[g[s].get(i)];
        if(s1[s]<=-x)
            s1[s]=-x;
    }
    
    static void print1(ArrayList<Integer>[] g,int n)
    {
        for(int i=0;i<n;i++)
        {
            System.out.print(i+"\t");
            for(int j=0;j<g[i].size();j++)
                System.out.print(g[i].get(j)+" ");
            System.out.println();
        }
    }
}