import java.util.Scanner;

public class Vizaard {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int and;
        int xor;
        int min = n;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < 100000; i++) {
            int step = (int) (n * Math.random()) + 1;
            int[] am = a.clone();
            for (int j = 0; j < step; j++) {
                int r = (int) (n * Math.random());
                am[r]++;
                am[r] -= 2 * (int) (Math.round(Math.random()));

            }
            and = am[0] & am[1];
            xor = am[0] ^ am[1];
            for (int k = 2; k < n; k++) {
                and = and & am[k];
                xor = xor ^ am[k];
            }
            if (and*xor >0 && step<min){
                min = step;
            }

        }
        System.out.println(min);
    }

}