#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>

#ifndef U_L_LONG
typedef unsigned long long U_L_LONG;
#endif
#ifndef L_LONG
typedef long long L_LONG;
#endif



static void ARC111A_task();

int main()
{
	ARC111A_task();
	
	fflush(stdout);
	return 0;
}

class ARC111A_dSet
{
public:
	int num = 0;
	int count = 0;
	bool isMajority = false;
};

class ATC111A_DataSetVector
{
public:
	std::vector<ARC111A_dSet> vData[2];

	bool setNumber(int num, unsigned int isOdd) 
	{
		if (isOdd > 1) { return false; }

		bool isNewNum = true;
		for (auto it = vData[isOdd].begin(); it != vData[isOdd].end(); it++) {
			if (it->num == num) {
				it->count++;
				isNewNum = false;
			}
		}
		if (isNewNum) {
			ARC111A_dSet tmp;
			tmp.num = num;
			tmp.count = 1;
			vData[isOdd].push_back(tmp);
		}

		return isNewNum;
	}

	bool isSingleNumber()
	{
		bool isSingle = false;
		
		if ((vData[0].size() == 1) && (vData[1].size() == 1)) {
			if (vData[0][0].num == vData[1][0].num) {
				isSingle = true;
			}
		}

		return isSingle;
	}

	static bool sort_cnt_dsc(const ARC111A_dSet& a, const ARC111A_dSet& b)
	{
		bool greater = false;
		if (a.count > b.count) {
			greater = true;
		}
		else if ((a.count == b.count) && (a.num > b.num)) {
			greater = true;
		}
		return greater;
	}
	
	int getMajority(int isOdd, int& maxNumberCount)
	{
		int maxNumCnt = 0;
		int maxCount = 0;
		for (auto it = vData[isOdd].begin(); it != vData[isOdd].end(); it++) {
			if (it->isMajority){
				maxCount = it->count;
				maxNumCnt = 1;
			}
			else if (maxCount == it->count) {
				maxNumCnt++;
			}
			else {
				break;
			}
		}

		maxNumberCount = maxNumCnt;
		return maxCount;
	}

	void sortNum()
	{
		std::sort(vData[0].begin(), vData[0].end(), sort_cnt_dsc);
		std::sort(vData[1].begin(), vData[1].end(), sort_cnt_dsc);
	}

	void decideMajority(int isOdd) {
		int maxCount = 0;
		
		vData[0][0].isMajority = vData[1][0].isMajority = false;
		if (vData[1].size() > 1) {
			vData[1][1].isMajority = false;
		}
		if (vData[0].size() > 1) {
			vData[0][1].isMajority = false;
		}

		if (vData[0][0].num == vData[1][0].num) {
			if (isOdd) {
				vData[0][0].isMajority = true;
				if (vData[1].size() > 1) {
					vData[1][1].isMajority = true;
				}
			}
			else {
				vData[1][0].isMajority = true;
				if (vData[0].size() > 1) {
					vData[0][1].isMajority = true;
				}
			}
		}
		else {
			vData[0][0].isMajority = vData[1][0].isMajority = true;
		}
	}

	int getMinorities()
	{
		int minorities = 0, retVal = INT_MAX;
		
		sortNum();
		for (int i = 0; i < 2; i++) {
			decideMajority(i & 0x1);
			minorities = 0;
			for (int i = 0; i < 2; i++) {
				for (auto it = vData[i].begin(); it != vData[i].end(); it++) {
					if (!(it->isMajority)) {
						minorities += it->count;
					}
				}
			}
			retVal = std::min(retVal, minorities);
		}
		return retVal;
	}
};


static void ARC111A_task()
{
	int N, tmp, numKinds[2] = { 0 };
	ATC111A_DataSetVector vDataSet;

	scanf(" %d", &N);
	
	for (int i = 0; i < N; i++) {
		scanf(" %d", &tmp);
		if (vDataSet.setNumber(tmp, i & 0x1)) {
			numKinds[i & 0x1]++;
		}
	}

	int targetCnt = 0;
#if 0
	if (vDataSet.isSingleNumber()) {
		targetCnt = vDataSet.getMajority(0, tmp);
		if ((targetCnt == 0) || (targetCnt > vDataSet.getMajority(1, tmp))) {
			targetCnt = vDataSet.getMajority(1, tmp);
		}
	}
	else
#endif
	{
		for (int i = 0; i < 2; i++) {
			targetCnt = vDataSet.getMinorities();
		}
	}
	printf("%d\n", targetCnt);
 }


Measured memory_bytes: 1724