// frequencyproblem.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;

int main()
{
	long long n;
	cin >> n;
	long long *a= new long long[n];
	long long *b = new long long[n];
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	for (int i = 0; i < n; i++)
	{
		cin >> b[i];
	}
	vector<pair<long long, long long>>x1, x2, y1, y2;
	long long vys = 0;
	for (int i = 0; i < n; i++)
	{
		vys += abs(a[i] - b[i]);
		if (a[i] < b[i])
		{
			x1.push_back({ a[i],b[i] });
			x2.push_back({ b[i],a[i] });
		}
		else
		{
			y1.push_back({ a[i],b[i] });
			y2.push_back({ b[i],a[i] });
		}
	}
	long long fin = vys;
	set<long long>s1;
	sort(x1.begin(), x1.end());
	sort(y2.begin(), y2.end());
	long long pocet = 0;
	for (auto i : x1)
	{
		while (pocet < y2.size() && y2[pocet].first <= i.first)
		{
			s1.insert(y2[pocet].second);
			pocet++;
		}
		if (s1.size() > 0)
		{
			long long last = *s1.rbegin();
			fin = min(fin, vys - 2 * (min(i.second, last) - i.first));
		}
	}
	set<long long>s2;
	sort(x1.begin(), x1.end());
	sort(y2.begin(), y2.end());
	long long pocet2 = 0;
	for (auto i : y2) {

		while (pocet2 < x1.size() && x1[pocet2].first <= i.first) 
		{
			s2.insert(x1[pocet2].second);
			pocet2++;
		}

		if (s2.size() > 0) 
		{
			long long int last;
			last = *s2.rbegin();
			fin = min(fin, vys - 2 * (min(last, i.second) - i.first));
		}

	}

	cout << fin << endl;
	return 0;
    //std::cout << "Hello World!\n";
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
