#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    if(arr[n-1] - arr[0] == 0 || arr[2*n - 1] - arr[n] == 0 || arr[2*n-1] - arr[0] == 0)
        {
            printf("0\n");
            return 0;
        }
    unsigned long long min = (unsigned long long)(arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n-1;i++)
    {
        if(arr[i+n-1] - arr[i] == 0)
        {
            printf("0\n");
            return 0;
        }
        unsigned long long x = (unsigned long long)(arr[i+n-1] - arr[i]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%lld\n", min);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    if(arr[n-1] - arr[0] == 0 || arr[2*n - 1] - arr[n] == 0 || arr[2*n-1] - arr[0] == 0)
        {
            printf("0\n");
            return 0;
        }
    unsigned long long min = (unsigned long long)(arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n;i++)
    {
        if(arr[i+n-1] - arr[i] == 0)
        {
            printf("0\n");
            return 0;
        }
        unsigned long long x = (unsigned long long)(arr[i+n-1] - arr[i]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%llu\n", min);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    unsigned long long min = (unsigned long long)(arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n;i++)
    {
        unsigned long long x = (unsigned long long)(arr[i+n-1] - arr[i]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%ulld\n", min);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    if(arr[n-1] - arr[0] == 0 || arr[2*n - 1] - arr[n] == 0 || arr[2*n-1] - arr[0] == 0)
        {
            printf("0\n");
            return 0;
        }
    long long min = (arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n-1;i++)
    {
        if(arr[i+n-1] - arr[i] == 0)
        {
            printf("0\n");
            return 0;
        }
        long long x = (arr[i+n-1] - arr[i]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%lld\n", min);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    long long min = (arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n-1;i++)
    {
        long long x = (arr[i+n-1] - arr[i]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%lld\n", min);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    long long min = (arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n - 1;i++)
    {
        long long x = (arr[i+n] - arr[0]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%lld\n", min);
    return 0;
}


#include <stdio.h>
#include <stdlib.h>

void merge(long arr[], int l, int m, int r)
{
    int i, j, k;
    int n1 = m - l + 1;
    int n2 =  r - m;

    /* create temp arrays */
    long L[n1], R[n2];

    /* Copy data to temp arrays L[] and R[] */
    for (i = 0; i < n1; i++)
        L[i] = arr[l + i];
    for (j = 0; j < n2; j++)
        R[j] = arr[m + 1+ j];

    /* Merge the temp arrays back into arr[l..r]*/
    i = 0; // Initial index of first subarray
    j = 0; // Initial index of second subarray
    k = l; // Initial index of merged subarray
    while (i < n1 && j < n2)
    {
        if (L[i] <= R[j])
        {
            arr[k] = L[i];
            i++;
        }
        else
        {
            arr[k] = R[j];
            j++;
        }
        k++;
    }

    /* Copy the remaining elements of L[], if there
       are any */
    while (i < n1)
    {
        arr[k] = L[i];
        i++;
        k++;
    }

    /* Copy the remaining elements of R[], if there
       are any */
    while (j < n2)
    {
        arr[k] = R[j];
        j++;
        k++;
    }
}

/* l is for left index and r is right index of the
   sub-array of arr to be sorted */
void mergeSort(long arr[], int l, int r)
{
    if (l < r)
    {
        // Same as (l+r)/2, but avoids overflow for
        // large l and h
        int m = l+(r-l)/2;

        // Sort first and second halves
        mergeSort(arr, l, m);
        mergeSort(arr, m+1, r);

        merge(arr, l, m, r);
    }
}

int main()
{
    int n;
    scanf("%d", &n);
    long arr[2*n];
    for(int i=0;i<2*n;i++)
        scanf("%ld", &arr[i]);
    mergeSort(arr, 0, 2*n-1);
    for(int i=0;i<2*n;i++)
        printf("%ld\n", arr[i]);
    long long min = (arr[n-1]-arr[0]) * (arr[2*n-1] - arr[n]);
    for(int i=1;i<n - 1;i++)
    {
        long long x = (arr[i+n] - arr[0]) * (arr[2*n - 1] - arr[0]);
        if(x < min)
            min = x;
    }
    printf("%lld\n", min);
    return 0;
}


using System;
using System.Collections.Generic;

namespace C_Sharp_Contest
{
    class Program
    {
        const int N = (int)1e5 + 5;

        static void Main(string[] args)
        {
            int n = II();
            int[] arr = new int[n * 2 + 1];
            for (int i = 1; i <= 2 * n; ++i) arr[i] = II();
            Array.Sort(arr);
            long ans = (arr[n] - arr[1]) * (arr[2 * n] - arr[n + 1]);
            for(int i = 2, j = n + 1; j < 2 * n; ++i, ++j)
            {
                long curr = arr[j] - arr[i];
                curr *= arr[2 * n] - arr[1];
                ans = Math.Min(ans, curr);
            }
            print(ans);
        }

        private static void print(Object o)
        {
            Console.WriteLine(o);
        }

        private static int II()
        {
            int num = 0;
            bool sign = true;
            char c = getChar();
            while (!((c >= '0' && c <= '9') || c == '-')) c = getChar();
            if (c == '-')
            {
                sign = false;
                c = getChar();
            }
            while (c >= '0' && c <= '9')
            {
                num = (num << 1) + (num << 3) + c - '0';
                c = getChar();
            }
            return sign ? num : -num;
        }
        private static char getChar()
        {
            return (char)Console.Read();
        }
    }
}


using System;
using System.Collections.Generic;

namespace C_Sharp_Contest
{
    class Program
    {
        const int N = (int)1e5 + 5;

        static void Main(string[] args)
        {
            int n = II();
            int[] arr = new int[n * 2 + 1];
            for (int i = 1; i <= 2 * n; ++i) arr[i] = II();
            Array.Sort(arr);
            long ans = (long)(arr[n] - arr[1]) * (arr[2 * n] - arr[n + 1]);
            for(int i = 2, j = n + 1; j < 2 * n; ++i, ++j)
            {
                long curr = arr[j] - arr[i];
                curr *= arr[2 * n] - arr[1];
                ans = Math.Min(ans, curr);
            }
            print(ans);
        }

        private static void print(Object o)
        {
            Console.WriteLine(o);
        }

        private static int II()
        {
            int num = 0;
            bool sign = true;
            char c = getChar();
            while (!((c >= '0' && c <= '9') || c == '-')) c = getChar();
            if (c == '-')
            {
                sign = false;
                c = getChar();
            }
            while (c >= '0' && c <= '9')
            {
                num = (num << 1) + (num << 3) + c - '0';
                c = getChar();
            }
            return sign ? num : -num;
        }
        private static char getChar()
        {
            return (char)Console.Read();
        }
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {

        int n = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x % 3).OrderBy(x => x).ToArray();
        long res = (a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]);
        long haba = a.Last() - a.First();
        for (int i = 0; i < n; i++)
        {
            res = Min(res, haba * (a[i + n - 1] - a[i]));
        }
        if (n == 1)
        {
            Console.WriteLine(0);
            return;
        }
        Console.WriteLine((a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]));
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {

        int n = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x % 3).OrderBy(x => x).ToArray();
        long res = (a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]);
        long haba = a.Last() - a.First();
        for (int i = 0; i < n; i++)
        {
            res = Min(res, haba * (a[i + n - 1] - a[i]));
        }
        if (n == 1)
        {
            Console.WriteLine(0);
            return;
        }
        Console.WriteLine(res);
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {

        int n = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x % 3).OrderBy(x => x).ToArray();
        if (n == 1)
        {
            Console.WriteLine(0);
            return;
        }
        long res = (a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]);
        long haba = a.Last() - a.First();
        for (int i = 0; i < n; i++)
        {
            res = Min(res, haba * (a[i + n] - a[i]));
        }
        Console.WriteLine((a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]));
    }
}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        long[] a = Console.ReadLine().Split().Select(long.Parse).OrderBy(x => x).ToArray();
        if (n == 1)
        {
            Console.WriteLine(0);
            return;
        }
        Console.WriteLine((a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]));
    }
}


#define EXTENDSTACKSIZE

using System;
 using System.Collections.Generic;
 using System.Dynamic;
 using System.Globalization;
using System.IO;
using System.Linq;
 using System.Linq.Expressions;
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            sr.NextInt32();
            sw.WriteLine(Solution(sr.ReadArrayOfInt32()));
        }

        private long Solution(int[] points)
        {
            Array.Sort(points);
            var minX1 = points[0];
            var maxX1 = points[points.Length / 2 - 1];
            var minY1 = points[points.Length/2];
            var maxY1 = points[points.Length - 1];

            var answ1 = ((long) maxX1 - minX1) * ((long) maxY1 - minY1);

            var minX2 = points[0];
            var maxX2 = points[points.Length - 1];
            var minY2 = points[points.Length/2 - 1];
            var maxY2 = points[points.Length/2];

            var answ2 = ((long) maxX2 - minX2) * ((long) maxY2 - minY2);

            return Math.Min(answ1, answ2);
        }

        private void Test()
        {
            var random = new Random();
            while (true) {
                var points = new[] { random.Next(0, 10), random.Next(0, 10), random.Next(0, 10), random.Next(0, 10) };
                var bfAnswer = BruteForce(points);
                var answ = Solution(points);
                if (bfAnswer != answ) {
                    throw new InvalidOperationException();
                }
            }
        }

        private long BruteForce(int[] points)
        {
            var answ = Int64.MaxValue;
            for (var i = 0; i < points.Length; i++) {
                for (var j = 0; j < points.Length; j++) {
                    if (i != j) {
                        for (var k = 0; k < points.Length; k++) {
                            if (k != i && k != j) {
                                for (var l = 0; l < points.Length; l++) {
                                    if (l != i && l != j && l != k) {
                                        var minX = Math.Min(points[i], points[j]);
                                        var maxX = Math.Max(points[i], points[j]);
                                        var minY = Math.Min(points[k], points[l]);
                                        var maxY = Math.Max(points[k], points[l]);
                                        var curr = ((long) maxX - minX) * ((long) maxY - minY);
                                        if (answ > curr) {
                                            answ = curr;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return answ;
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

class Base
{
    public long Id;
}

class Derived : Base
{
    public string Name { get; set; }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var points = sr.ReadArrayOfInt32();
            Array.Sort(points);

            var answ = Int64.MaxValue;
            for (var i = 0; i < n; i++) {
                var minX = points[i];
                var maxX = points[i + n - 1];
                var minY = i > 0 ? points[i - 1] : points[n];
                var maxY = points[points.Length - 1];
                var d = (maxX - minX) * (maxY - minY);
                answ = Math.Min(d, answ);
            }

            sw.WriteLine(answ);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var points = sr.ReadArrayOfInt32();
            Array.Sort(points);
            var minX = points[0];
            var maxX = points[n - 1];
            var minY = points[n];
            var maxY = points[2 * n - 1];

            sw.WriteLine(((long)maxX - minX) * ((long)maxY - minY));
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var points = sr.ReadArrayOfInt32();
            Array.Sort(points);

            var answ = Int64.MaxValue;
            for (var i = 0; i <= n; i++) {
                var minX = points[i];
                var maxX = points[i + n - 1];
                var minY = i > 0 ? points[0] : points[n];
                var maxY = i < n ? points[points.Length - 1] : points[n - 1];
                var d = (maxX - minX) * (maxY - minY);
                answ = Math.Min(d, answ);
            }

            sw.WriteLine(answ);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var points = sr.ReadArrayOfInt32();
            Array.Sort(points);

            var answ = Int64.MaxValue;
            for (var i = 0; i <= n; i++) {
                var minX = points[i];
                var maxX = points[i + n - 1];
                var minY = i > 0 ? points[i - 1] : points[n];
                var maxY = points[points.Length - 1];
                var d = (maxX - minX) * (maxY - minY);
                answ = Math.Min(d, answ);
            }

            sw.WriteLine(answ);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var points = sr.ReadArrayOfInt32();
            Array.Sort(points);

            var answ = Int64.MaxValue;
            for (var i = 0; i <= n; i++) {
                var minX = points[i];
                var maxX = points[i + n - 1];
                var minY = i > 0 ? points[0] : points[n];
                var maxY = i < n ? points[points.Length - 1] : points[n - 1];
                var d = ((long)maxX - minX) * ((long)maxY - minY);
                answ = Math.Min(d, answ);
            }

            sw.WriteLine(answ);
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
 using System.Text;
 using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var increase = sr.ReadArrayOfInt64();
            var decrease = (long[])increase.Clone();
            Array.Sort(increase);
            Array.Sort(decrease, (a, b) => -a.CompareTo(b));
            var minX = increase[0];
            var maxY = decrease[0];
            var maxX = increase[n - 1];
            var minY = decrease[n - 1];
//            var minSet = new SortedDictionary<long, int>();
//            var maxSet = new SortedDictionary<long, int>();
//            for (var i = 0; i < n; i++) {
//                if (!minSet.ContainsKey(increase[i])) {
//                    minSet.Add(increase[i], 0);
//                }
//
//                minSet[increase[i]]++;
//            }
//
//            for (var i = 0; i < n; i++) {
//                if(maxSe)
//            }
            sw.WriteLine((maxX - minX) * (maxY - minY));
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
 using System.Text;
 using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 32 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            sr.NextInt32();
            sw.WriteLine(BruteForce(sr.ReadArrayOfInt64()));
//            Generate();
        }

        private void Generate()
        {
            var rnd = new Random();
            while (true) {
                var points = new long[]{rnd.Next(0, 10), rnd.Next(0, 10), rnd.Next(0, 10), rnd.Next(0, 10)};
                var answ1 = Original(points);
                var answ2 = BruteForce(points);
                if (answ1 != answ2)
                    throw new InvalidOperationException();
            }
        }

        private long Original(long[] points)
        {
            var n = points.Length / 2;
            var increase = (long[])points.Clone();
            var decrease = (long[])points.Clone();
            Array.Sort(increase);
            Array.Sort(decrease, (a, b) => -a.CompareTo(b));
            var minX1 = increase[0];
            var maxY1 = decrease[0];
            var maxX1 = increase[n - 1];
            var minY1 = decrease[n - 1];

            var minX2 = increase[0];
            var maxX2 = increase[n - 1];
            var maxY2 = decrease[0];
            var minY2 = decrease[n - 1];

            return Math.Min((maxX1 - minX1) * (maxY1 - minY1), (maxX2 - minX2) * (maxY2 - minY2));
        }

        private long BruteForce(long[] numbers)
        {
            var answ = Int64.MaxValue;
            Array.Sort(numbers);
            var set = new SortedSet<long>(numbers);
            if (set.Count < 4) {
                return 0L;
            }

            var points = new long[4];
            points[0] = set.Min;
            set.Remove(set.Min);
            points[1] = set.Min;
            set.Remove(set.Min);
            points[3] = set.Max;
            set.Remove(set.Max);
            points[2] = set.Max;
            set.Remove(set.Max);
            var newSet = set.ToArray();
            for (var i = 0; i < points.Length; i++) {
                for (var j = 0; j < points.Length; j++) {
                    if (i != j) {
                        for (var k = 0; k < points.Length; k++) {
                            if (k != i && k != j) {
                                for (var l = 0; l < points.Length; l++) {
                                    if (l != i && l != j && l != k) {
                                        var d1 = Math.Abs(points[i] - points[k]);
                                        var d2 = Math.Abs(points[j] - points[l]);
                                        if (answ > d1 * d2) {
                                            var maxX = Math.Max(points[i], points[k]);
                                            var minX = Math.Min(points[i], points[k]);
                                            var maxY = Math.Max(points[j], points[l]);
                                            var minY = Math.Min(points[j], points[l]);
                                            var can = true;
                                            for (var m = 0; m < newSet.Length / 2; m++) {
                                                if (newSet[m] >= minX && newSet[m] <= maxX && newSet[points.Length - m - 1] >= minY && newSet[points.Length - m - 1] <= maxY) {
                                                    continue;
                                                }
                                                if (newSet[m] >= minY && newSet[m] <= maxY && newSet[points.Length - m - 1] >= minX && newSet[points.Length - m - 1] <= maxX) {
                                                    continue;
                                                }

                                                can = false;
                                            }
                                            if(can)
                                                answ = d1 * d2;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return answ;
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"sort"
)

type Scanner struct{
	buf []byte
	len int
	index int
}

func readInt(scanner *Scanner) int{
	var ret int = 0
	var valid = false
	for i := scanner.index; i < scanner.len; i++ {
		var ch = scanner.buf[i]
		var k = 0
		if ch >= '0' && ch <= '9' {
			k = (int)(ch - '0')
			ret = ret * 10 + k
			valid = true
		}else if valid{
			scanner.index = i + 1
			break
		}
	}
	return ret
}

func run(a []int, n int) int64 {
	if n == 1 {
		return 0
	}
	sort.Ints(a)
	var w = int64(a[n - 1] - a[0])
	var h = int64(a[n * 2 - 1] - a[n])
	return w * h
}

func main()  {

	buffer, error := ioutil.ReadAll(os.Stdin)

	if error != nil {
		log.Fatal(error)
		return
	}

	var scanner = &Scanner{
		buf:buffer,
		len:len(buffer),
		index:0,
	}

	var n = readInt(scanner)
	var m = n << 1
	var a = make([]int,m)
	for i := 0; i < m; i++ {
		a[i] = readInt(scanner)
	}

	fmt.Println(run(a,n))
}


package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"os"
	"sort"
)

type Scanner struct{
	buf []byte
	len int
	index int
}

func (scanner *Scanner) readInt() int{
	var ret = 0
	var valid = false
	for i := scanner.index; i < scanner.len; i++ {
		var ch = scanner.buf[i]
		var k = 0
		if ch >= '0' && ch <= '9' {
			k = (int)(ch - '0')
			ret = ret * 10 + k
			valid = true
		}else if valid{
			scanner.index = i + 1
			break
		}
	}
	return ret
}

func run(a []int, n int) int64 {
	if n == 1 {
		return 0
	}
	sort.Ints(a)
	var w = int64(a[n - 1] - a[0])
	var h = int64(a[n * 2 - 1] - a[n])
	var ans = w * h
	var m = n * 2

	w = int64(a[n * 2 - 1] - a[0])

	min := func(x int64, y int64) int64 {
		if x < y {
			return x
		}
		return y
	}
	for i := n ; i + 1 < m; i++ {
		h = int64(a[i] - a[i - n + 1])
		ans = min(ans,h * w)
	}
	return ans
}

func main()  {

	buffer, error := ioutil.ReadAll(os.Stdin)

	if error != nil {
		log.Fatal(error)
		return
	}

	var scanner = &Scanner{
		buf:buffer,
		len:len(buffer),
		index:0,
	}

	var n = scanner.readInt()
	var m = n << 1
	var a = make([]int,m)
	for i := 0; i < m; i++ {
		a[i] = scanner.readInt()
	}

	fmt.Println(run(a,n))
}


from sys import stdin, stdout
ti = lambda : stdin.readline().strip()
ma = lambda fxn, ti : map(fxn, ti.split())
ol = lambda arr : stdout.write(' '.join(str(i) for i in arr) + '\n')
os = lambda i : stdout.write(str(i) + '\n')
olws = lambda arr : stdout.write(''.join(str(i) for i in arr) + '\n')

n = int(ti())
a = ma(int, ti())
if n == 1:
	os(0)
	exit()
a.sort()

mid = n
import sys
ans = sys.maxsize
for i in range(n+1):
	xmax = a[mid+i-1]
	xmin = a[i]

	ymax = a[2*n-1]
	if i == 0:
		ymin = a[mid]
	else:
		ymin = a[0]

	ans = min(ans, (xmax - xmin)*(ymax - ymin))

os(ans)


from sys import stdin, stdout
ti = lambda : stdin.readline().strip()
ma = lambda fxn, ti : map(fxn, ti.split())
ol = lambda arr : stdout.write(' '.join(str(i) for i in arr) + '\n')
os = lambda i : stdout.write(str(i) + '\n')
olws = lambda arr : stdout.write(''.join(str(i) for i in arr) + '\n')

n = int(ti())
a = ma(int, ti())
if n == 1:
	os(0)
	exit()
a.sort()

mid = n
import sys
ans = pow(10, 20)
for i in range(n+1):
	xmax = a[mid+i-1]
	xmin = a[i]

	ymax = a[2*n-1]
	if i == 0:
		ymin = a[mid]
	else:
		ymin = a[0]

	ans = min(ans, (xmax - xmin)*(ymax - ymin))

os(ans)


n = input()
ll = map(int, raw_input().split(" "))

ll.sort()
mf = None
mfi = None
for i in xrange(n+1):
    #print ll[i+n-1], ll[i]
    if mf is None or ll[i+n-1] - ll[i] < mf:
        #print "--", i
        mf = ll[i+n-1] - ll[i]
        mfi = i

row = ll[mfi:mfi+n]
col = ll[:mfi] + ll[mfi+n:]

print (row[-1]-row[0]) * (col[-1] - col[0])


n = input()
ll = map(int, raw_input().split(" "))

ll.sort()

mox = ll[n-1]
mix = ll[0]
moy = ll[-1]
miy = ll[n]

#print mox, mix, moy, miy

tut = (mox-mix) * (moy-miy)

from collections import Counter
dd = Counter(ll)

check = False
for key in dd:
    if dd[key] >= n:
        print 0
        check = True
        break

if not check:
    print tut


n = input()
ll = map(int, raw_input().split(" "))

ll.sort()
result = None
for i in xrange(n+1):
    xfark = ll[i+n-1] - ll[i]
    if i > 0:
        if i != n:
            yfark = ll[-1] - ll[0]
        else:
            yfark = ll[n-1] - ll[0]
    else:
        yfark = ll[-1] - ll[n]

    if result is None or xfark*yfark < result:
        result = xfark*yfark

print result


n = input()
ll = map(int, raw_input().split(" "))

ll.sort()

mox = ll[n-1]
mix = ll[0]
moy = ll[-1]
miy = ll[n]

#print mox, mix, moy, miy

print (mox-mix) * (moy-miy)


"""
________        _____________              ______
___  __ \____  ____  __ \__(_)__   _______ ___  /
__  /_/ /_  / / /_  /_/ /_  /__ | / /  __ `/_  /
_  ____/_  /_/ /_  _, _/_  / __ |/ // /_/ /_  /
/_/     _\__, / /_/ |_| /_/  _____/ \__,_/ /_/
        /____/

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
import sys
from atexit import register
from bisect import bisect_left, bisect_right

# import random
from collections import Counter
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    from io import BytesIO as stream
    # from fractions import Fraction
    # from fractions import gcd
    # from cPickle import dumps
    # from Queue import PriorityQueue, Queue
else:
    from io import StringIO as stream
    # from functools import reduce
    # from fractions import Fraction
    # from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        def items(self):
            return dict.iteritems(self)

        def keys(self):
            return dict.iterkeys(self)

        def values(self):
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """
    Sets whether the standard Python streams are allowed to buffer their I/O.

    Parameters
    ----------
    sync : bool, optional
        The new synchronization setting. Default is True.
    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = sorted(map(int, input().split(' ')))
    print((a[n - 1] - a[0]) * (a[-1] - a[-n]))

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    sync_with_stdio()
    main()


"""
________        _____________              ______
___  __ \____  ____  __ \__(_)__   _______ ___  /
__  /_/ /_  / / /_  /_/ /_  /__ | / /  __ `/_  /
_  ____/_  /_/ /_  _, _/_  / __ |/ // /_/ /_  /
/_/     _\__, / /_/ |_| /_/  _____/ \__,_/ /_/
        /____/

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
import sys
from atexit import register
from bisect import bisect_left, bisect_right

# import random
from collections import Counter
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    from io import BytesIO as stream
    # from fractions import Fraction
    # from fractions import gcd
    # from cPickle import dumps
    # from Queue import PriorityQueue, Queue
else:
    from io import StringIO as stream
    # from functools import reduce
    # from fractions import Fraction
    # from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        def items(self):
            return dict.iteritems(self)

        def keys(self):
            return dict.iterkeys(self)

        def values(self):
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """
    Sets whether the standard Python streams are allowed to buffer their I/O.

    Parameters
    ----------
    sync : bool, optional
        The new synchronization setting. Default is True.
    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = sorted(map(int, input().split(' ')))
    print(min((a[n - 1] - a[0]) * (a[-1] - a[-n]), (a[-1] - a[0]) * (a[-2] - a[1])))

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    sync_with_stdio()
    main()


"""
________        _____________              ______
___  __ \____  ____  __ \__(_)__   _______ ___  /
__  /_/ /_  / / /_  /_/ /_  /__ | / /  __ `/_  /
_  ____/_  /_/ /_  _, _/_  / __ |/ // /_/ /_  /
/_/     _\__, / /_/ |_| /_/  _____/ \__,_/ /_/
        /____/

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
import sys
from atexit import register
from bisect import bisect_left, bisect_right

# import random
from collections import Counter
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    from io import BytesIO as stream
    # from fractions import Fraction
    # from fractions import gcd
    # from cPickle import dumps
    # from Queue import PriorityQueue, Queue
else:
    from io import StringIO as stream
    # from functools import reduce
    # from fractions import Fraction
    # from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        def items(self):
            return dict.iteritems(self)

        def keys(self):
            return dict.iterkeys(self)

        def values(self):
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """
    Sets whether the standard Python streams are allowed to buffer their I/O.

    Parameters
    ----------
    sync : bool, optional
        The new synchronization setting. Default is True.
    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = sorted(map(int, input().split(' ')))
    case_1 = (a[-1] - a[0]) * min(a[i + n - 1] - a[i] for i in range(1, n - 1))
    case_2 = (a[n - 1] - a[0]) * (a[-1] - a[-n])
    print(min(case_1, case_2))

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    sync_with_stdio()
    main()


"""
________        _____________              ______
___  __ \____  ____  __ \__(_)__   _______ ___  /
__  /_/ /_  / / /_  /_/ /_  /__ | / /  __ `/_  /
_  ____/_  /_/ /_  _, _/_  / __ |/ // /_/ /_  /
/_/     _\__, / /_/ |_| /_/  _____/ \__,_/ /_/
        /____/

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
import sys
from atexit import register
from bisect import bisect_left, bisect_right

# import random
from collections import Counter
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    from io import BytesIO as stream
    # from fractions import Fraction
    # from fractions import gcd
    # from cPickle import dumps
    # from Queue import PriorityQueue, Queue
else:
    from io import StringIO as stream
    # from functools import reduce
    # from fractions import Fraction
    # from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        def items(self):
            return dict.iteritems(self)

        def keys(self):
            return dict.iterkeys(self)

        def values(self):
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """
    Sets whether the standard Python streams are allowed to buffer their I/O.

    Parameters
    ----------
    sync : bool, optional
        The new synchronization setting. Default is True.
    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    a = sorted(map(int, input().split(' ')))
    case_1 = (a[-1] - a[0]) * min(a[i + n - 1] - a[i] for i in range(1, n))
    case_2 = (a[n - 1] - a[0]) * (a[-1] - a[-n])
    print(min(case_1, case_2))

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    sync_with_stdio()
    main()


"""
________        _____________              ______
___  __ \____  ____  __ \__(_)__   _______ ___  /
__  /_/ /_  / / /_  /_/ /_  /__ | / /  __ `/_  /
_  ____/_  /_/ /_  _, _/_  / __ |/ // /_/ /_  /
/_/     _\__, / /_/ |_| /_/  _____/ \__,_/ /_/
        /____/

https://github.com/Cheran-Senthil/PyRival
Copyright (c) 2018 Cheran Senthilkumar
"""
from __future__ import division, print_function

import cmath
import itertools
import math
import operator as op
import sys
from atexit import register
from bisect import bisect_left, bisect_right

# import random
from collections import Counter
# from copy import deepcopy
# from decimal import Decimal
# from difflib import SequenceMatcher
# from heapq import heappop, heappush

if sys.version_info[0] < 3:
    from io import BytesIO as stream
    # from fractions import Fraction
    # from fractions import gcd
    # from cPickle import dumps
    # from Queue import PriorityQueue, Queue
else:
    from io import StringIO as stream
    # from functools import reduce
    # from fractions import Fraction
    # from math import gcd
    # from pickle import dumps
    # from queue import PriorityQueue, Queue

if sys.version_info[0] < 3:
    class dict(dict):
        def items(self):
            return dict.iteritems(self)

        def keys(self):
            return dict.iterkeys(self)

        def values(self):
            return dict.itervalues(self)

    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

def sync_with_stdio(sync=True):
    """
    Sets whether the standard Python streams are allowed to buffer their I/O.

    Parameters
    ----------
    sync : bool, optional
        The new synchronization setting. Default is True.
    """
    global input, flush

    if sync:
        flush = sys.stdout.flush
    else:
        sys.stdin = stream(sys.stdin.read())
        input = lambda: sys.stdin.readline().rstrip('\r\n')

        sys.stdout = stream()
        register(lambda: sys.__stdout__.write(sys.stdout.getvalue()))

def main():
    n = int(input())
    if n == 1:
        print(0)
        exit()
    a = sorted(map(int, input().split(' ')))
    case_1 = (a[-1] - a[0]) * min(a[i + n - 1] - a[i] for i in range(1, n))
    case_2 = (a[n - 1] - a[0]) * (a[-1] - a[-n])
    print(min(case_1, case_2))

if __name__ == '__main__':
    sys.setrecursionlimit(10000)
    sync_with_stdio()
    main()


n = int(raw_input())
nums = sorted(list(map(int,raw_input().split())))
ans = (nums[n-1]-nums[0])*(nums[-1]-nums[n])
for i in range(n-1):
  ans = min(ans,(nums[n+i]-nums[i+1])*(nums[-1]-nums[0]))
print ans


n = int(raw_input())
nums = sorted(list(map(int,raw_input().split())))
print (nums[n-1]-nums[0])*(nums[-1]-nums[n])


n=input()
lst=map(int,raw_input().split())
lst.sort()
ans=[]
for i in range(0,n):
  if i==0:
    ans.append( (lst[i+n-1]-lst[i])*(lst[2*n-1]-lst[n]))
  else:
    ans.append( (lst[i+n-1]-lst[i])*(lst[2*n-1]-lst[0]))
print min(ans)


n=input()
lst=map(int,raw_input().split())
lst.sort()
print (lst[n-1]-lst[0])*(lst[2*n-1]-lst[n])


import sys, math
from sys import stdin, stdout
rem = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, raw_input().split())

n=input()
arr=take()
arr.sort()
a=arr[0]
b=arr[n-1]
c=arr[n]
d=arr[-1]
x=abs(b-a)*abs(d-c)
right=abs(arr[0]-arr[-1])
for i in range(1,n):
    a=arr[i]
    b=arr[i+n-1]
    x=min(x,abs(b-a)*right)
print x


import sys, math
from sys import stdin, stdout
rem = 10 ** 9 + 7
sys.setrecursionlimit(10 ** 6)
take = lambda: map(int, raw_input().split())

n=input()
arr=take()
arr.sort()
a=arr[0]
b=arr[n-1]
c=arr[n]
d=arr[-1]
print abs(b-a)*abs(d-c)


#import resource
#import sys
#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])
#import threading
#threading.stack_size(2**26)
#sys.setrecursionlimit(0x1000000)
from sys import stdin, stdout
mod=(10**9)+7
mod1=mod-1
def modinv(n,p):
    return pow(n,p-2,p)
def ncr(n,r,p):
    t=((fact[n])*(modinv(fact[r],p)%p)*(modinv(fact[n-r],p)%p))%p
    return t
def GCD(x, y):
   while(y):
       x, y = y, x % y
   return x
def BS(arr, l, r, x):
    if r >= l:
        mid = l + (r - l)/2
        if arr[mid] == x:
            return mid
        elif arr[mid] > x:
            return BS(arr, l, mid-1, x)
        else:
            return BS(arr, mid+1, r, x)
    else:n -1
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import math
from Queue import Queue as Q
import heapq
from random import randint as rn
def comp(x,y):
    if(x[0]<y[0]):
        return -1
    elif(x[0]==y[0]):
        if(x[1]<y[1]):
            return -1
        else:
            return 1
    else:
        return 1
"""---------------------------------------------------------------------"""
a=input()
b=map(int,raw_input().split())
b.sort()
x=b[a-1]-b[0]
y=b[2*a-1]-b[a]
t=x*y
for i in range(1,a-1):
    x=b[a-1+i]-b[i]
    y=b[2*a-1]-b[0]
    r=x*y
    t=min(t,r)
print t


#import resource
#import sys
#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])
#import threading
#threading.stack_size(2**26)
#sys.setrecursionlimit(0x1000000)
from sys import stdin, stdout
mod=(10**9)+7
mod1=mod-1
def modinv(n,p):
    return pow(n,p-2,p)
def ncr(n,r,p):
    t=((fact[n])*(modinv(fact[r],p)%p)*(modinv(fact[n-r],p)%p))%p
    return t
def GCD(x, y):
   while(y):
       x, y = y, x % y
   return x
def BS(arr, l, r, x):
    if r >= l:
        mid = l + (r - l)/2
        if arr[mid] == x:
            return mid
        elif arr[mid] > x:
            return BS(arr, l, mid-1, x)
        else:
            return BS(arr, mid+1, r, x)
    else:n -1
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import math
from Queue import Queue as Q
import heapq
from random import randint as rn
def comp(x,y):
    if(x[0]<y[0]):
        return -1
    elif(x[0]==y[0]):
        if(x[1]<y[1]):
            return -1
        else:
            return 1
    else:
        return 1
"""---------------------------------------------------------------------"""
a=input()
b=map(int,raw_input().split())
b.sort()
x=b[a-1]-b[0]
y=b[2*a-1]-b[a]
print x*y


#import resource
#import sys
#resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])
#import threading
#threading.stack_size(2**26)
#sys.setrecursionlimit(0x1000000)
from sys import stdin, stdout
mod=(10**9)+7
mod1=mod-1
def modinv(n,p):
    return pow(n,p-2,p)
def ncr(n,r,p):
    t=((fact[n])*(modinv(fact[r],p)%p)*(modinv(fact[n-r],p)%p))%p
    return t
def GCD(x, y):
   while(y):
       x, y = y, x % y
   return x
def BS(arr, l, r, x):
    if r >= l:
        mid = l + (r - l)/2
        if arr[mid] == x:
            return mid
        elif arr[mid] > x:
            return BS(arr, l, mid-1, x)
        else:
            return BS(arr, mid+1, r, x)
    else:n -1
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import math
from Queue import Queue as Q
import heapq
from random import randint as rn
def comp(x,y):
    if(x[0]<y[0]):
        return -1
    elif(x[0]==y[0]):
        if(x[1]<y[1]):
            return -1
        else:
            return 1
    else:
        return 1
"""---------------------------------------------------------------------"""
a=input()
b=map(int,raw_input().split())
b.sort()
x=b[a-1]-b[0]
y=b[2*a-1]-b[a]
t=x*y
for i in range(1,a):
    x=b[a-1+i]-b[i]
    y=b[2*a-1]-b[0]
    r=x*y
    t=min(t,r)
print t


# -*- coding: utf-8 -*-
"""
Created on Mon Jul 30 16:39:48 2018

@author: a0309
"""

n = int(raw_input())

a = [int(p) for p in raw_input().split()]

a.sort()

ans = (a[n - 1] - a[0]) * (a[-1] - a[n])

dic = {}

flag = True
for data in a:
    if data not in dic:
        dic[data] = 1
    else:
        dic[data] = dic[data] + 1
    if dic[data] == n:
        flag = False
        print(0)

if (flag):
    print(ans)


# -*- coding: utf-8 -*-
"""
Created on Mon Jul 30 16:39:48 2018

@author: a0309
"""

n = int(raw_input())

a = [int(p) for p in raw_input().split()]

a.sort()

print((a[n - 1] - a[0]) * (a[-1] - a[n]))


#include<bits/stdc++.h>
#define MAXN 100005
using namespace std;
int n,ans;
int maxst[MAXN][20],minst[MAXN][20],lg[MAXN];
int maxquery(int x,int y)
{
	int k=lg[y-x+1]-1;
	return max(maxst[x][k],maxst[y-(1<<k)+1][k]);
}
int minquery(int x,int y)
{
	int k=lg[y-x+1]-1;
	return min(minst[x][k],minst[y-(1<<k)+1][k]);
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>maxst[i][0];
	}
	for(int i=1;i<=n;i++)
	{
		cin>>minst[i][0];
	}
	for(int j=1;j<20;j++)
	{
		for(int i=1;(1<<j)+i-1<=n;i++)
		{
			maxst[i][j]=max(maxst[i][j-1],maxst[i+(1<<(j-1))][j-1]);
			minst[i][j]=min(minst[i][j-1],minst[i+(1<<(j-1))][j-1]);
		}
	}
	for(int i=1;i<=n;i++)
	{
		lg[i]=lg[i-1]+((1<<lg[i-1])==i);
	}
	for(int i=1;i<=n;i++)
	{
		if(minst[i][0]<maxst[i][0])
		{
			continue;
		}
		int l=i,r=n,lans=-1,rans=-1;
		while(l<=r)
		{
			int mid=(l+r)/2;
			if(maxquery(i,mid)>minquery(i,mid))
			{
				r=mid-1;
			}
			else if(maxquery(i,mid)<minquery(i,mid))
			{
				l=mid+1;
			}
			else
			{
				lans=mid;
				r=mid-1;
			}
		}
		if(lans==-1)
		{
			continue;
		}
		l=i,r=n;
		while(l<=r)
		{
			int mid=(l+r)/2;
			if(maxquery(i,mid)>minquery(i,mid))
			{
				r=mid-1;
			}
			else if(maxquery(i,mid)<minquery(i,mid))
			{
				l=mid+1;
			}
			else
			{
				rans=mid;
				l=mid+1;
			}
		}
		ans+=rans-lans+1;
	}
	cout<<ans<<endl;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long LL;
const int N=200000+5;
int n,a[N],b[N],st1[N][20],st2[N][20];
inline int maxlr(int l,int r){
	int len=r-l+1;
	int log_len=log2(len);
	return max(st1[l][log_len],st1[r-(1<<log_len)+1][log_len]);
}
inline int minlr(int l,int r){
	int len=r-l+1;
	int log_len=log2(len);
	return min(st2[l][log_len],st2[r-(1<<log_len)+1][log_len]);
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		st1[i][0]=a[i];
	}
	for(int i=1;i<=n;i++){
		cin>>b[i];
		st2[i][0]=b[i];
	}
	for(int j=1;(1<<j)<=n;j++){
		for(int i=1;i<=n;i++){
			if(i+(1<<j)-1<=n){
				st1[i][j]=max(st1[i][j-1],st1[i+(1<<(j-1))][j-1]);
				st2[i][j]=min(st2[i][j-1],st2[i+(1<<(j-1))][j-1]);
			}
		}
	}
	LL ans=0;
	for(int i=1;i<=n;i++){
		int l=i,r=n,L=-1,R=-1;
		while(r-l>5){
			int mid=(l+r)/2;
			if(maxlr(i,mid)>=minlr(i,mid)) r=mid;
			else l=mid;
		}
		for(int j=l;j<=r;j++){
			if(maxlr(i,j)==minlr(i,j)){
				L=j;
				break;
			}
		}
		l=i,r=n;
		while(r-l>5){
			int mid=(l+r)/2;
			if(maxlr(i,mid)>minlr(i,mid)) r=mid;
			else l=mid;
		}
		for(int j=r;j>=l;j--){
			if(maxlr(i,j)==minlr(i,j)){
				R=j;
				break;
			}
		}
//		for(int j=i;j<=n;j++){
//			cout<<maxlr(i,j)<<" ";
//		}
//		cout<<endl;
//		for(int j=i;j<=n;j++){
//			cout<<minlr(i,j)<<" ";
//		}
//		cout<<endl;
//		cout<<i<<" "<<L<<" "<<R<<" "<<endl<<endl;

		if(L!=-1&&R!=-1){
			LL len=R-L+1;
			ans+=len;
		}
	}
	cout<<ans<<endl;
	return 0;
}


#include<cstdio>
#include<algorithm>
#include<cmath>
using std::min;
using std::max;
using std::log;
int n;
const int N=200010;
int a[N],b[N],stmax[N][25],stmin[N][25],lg[N];
long long cnt;
int len,lgn;
inline int get_max(int x,int y)
{
	len=y-x+1;
	lgn=lg[len];
	return max(stmax[x][lgn],stmax[y-(1<<lgn)+1][lgn]);
}
inline int get_min(int x,int y)
{
	len=y-x+1;
	lgn=lg[len];
	return min(stmin[x][lgn],stmin[y-(1<<lgn)+1][lgn]);
}
inline int get_ans(int x,int y)
{
	return get_max(x,y)-get_min(x,y);
}
inline int get_l(int l,int r)
{
	int i=l;
	while(r-l>5)
	{
		int mid=((l+r)>>1);
		int k=get_ans(i,mid);
		if(k>=0) r=mid;
		else l=mid+1;
	}
	for(int j=l;j<=r;j++)
	{
		if(get_ans(i,j)==0) return j;
	}
	return -1;
}
inline int get_r(int l,int r)
{
	int i=l;
	while(r-l>5)
	{
		int mid=((l+r)>>1);
		int k=get_ans(i,mid);
		if(k<=0) l=mid;
		else if(k==0) r=mid;
		else l=mid+1;
	}
	for(int j=r;j>=l;j--)
	{
		if(get_ans(i,j)==0) return j;
	}
	return -1;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),stmax[i][0]=a[i];
	for(int i=1;i<=n;i++) scanf("%d",&b[i]),stmin[i][0]=b[i];
	for(int j=1;(1<<j)<=n;j++)
	{
		for(int i=1;i+(1<<j)-1<=n;i++)
		{
			stmax[i][j]=max(stmax[i][j-1],stmax[i+(1<<(j-1))][j-1]);
			stmin[i][j]=min(stmin[i][j-1],stmin[i+(1<<(j-1))][j-1]);
		}
	}
	for(int i=1;i<=n;i++) lg[i]=log(i)/log(2);
	for(int i=1;i<=n;i++)
	{
		int ans1=get_l(i,n),ans2=get_r(i,n);
		if(ans1!=-1&&ans2!=-1) cnt+=(ans2-ans1+1);
	}
	printf("%lld",cnt);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int MAXN = 200055;
int n;
int a[MAXN], b[MAXN];
int sta[MAXN][75], stb[MAXN][75];
long long ans = 0;

inline int get_maxa(int l, int r)
{
	int len = log(r - l + 1) / log(2);
	return max(sta[l][len], sta[r - (1 << len) + 1][len]);
}

inline int get_minb(int l, int r)
{
	int len = log(r - l + 1) / log(2);
	return min(stb[l][len], stb[r - (1 << len) + 1][len]);
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	for(int i = 1; i <= n; i++)
		scanf("%d", &b[i]);
	for(int i = 1; i <= n; i++)
	{
		sta[i][0] = a[i];
		stb[i][0] = b[i];
	}
	for(int j = 1; (1 << j) <= n; j++)
	{
		for(int i = 1; i + (1 << j) - 1 <= n; i++)
		{
			sta[i][j] = max(sta[i][j - 1], sta[i + (1 << (j - 1))][j - 1]);
			stb[i][j] = min(stb[i][j - 1], stb[i + (1 << (j - 1))][j - 1]);
		}
	}
	for(int i = 1; i <= n; i++)
	{
		int res1, res2;
		int l = i, r = n, mid;
		while(l < r)
		{
			mid = (l + r) >> 1;
 			if(get_maxa(i, mid) - get_minb(i, mid) >= 0)
				r = mid;
			else
				l = mid + 1;
		}
		if(get_maxa(i, l) - get_minb(i, l) != 0)
			continue;
		res1 = l;
		l = i;
		r = n + 1;
		while(l < r)
		{
			mid = (l + r) >> 1;
			if(get_maxa(i, mid) - get_minb(i, mid) <= 0)
				l = mid + 1;
			else
				r = mid;
		}
		res2 = l - 1;
		ans += res2 - res1 + 1;
	}
	cout << ans << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=200005;
int n,a[MAXN],b[MAXN],stmax[MAXN][20],stmin[MAXN][20];
int LOG[MAXN];
inline int queryMax(int l,int r){
	int k=LOG[r-l+1];
	return max(stmax[l][k],stmax[r+1-(1<<k)][k]);
}
inline int queryMin(int l,int r){
	int k=LOG[r-l+1];
	return min(stmin[l][k],stmin[r+1-(1<<k)][k]);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		stmax[i][0]=a[i];
	}
	for(int i=1;i<=n;i++){
		scanf("%d",&b[i]);
		stmin[i][0]=b[i];
	}
	for(int j=1;j<20;j++){
		for(int i=1;i+(1<<j)-1<=n;i++){
			stmax[i][j]=max(stmax[i][j-1],stmax[i+(1<<(j-1))][j-1]);
			stmin[i][j]=min(stmin[i][j-1],stmin[i+(1<<(j-1))][j-1]);
		}
	}
	LOG[0]=0;
	for(int i=1;i<=n;i++){
		LOG[i]=LOG[i-1]+((1<<LOG[i-1])==i);
	}
	for(int i=1;i<=n;i++){
		LOG[i]--;
	}
	ll ans=0;
	for(int i=1;i<=n;i++){
		if(b[i]<a[i]){
			continue;
		}
		int l=-1,r=-1;
		int low=i,high=n;
		while(low<=high){
			int mid=(low+high)/2;
			if(queryMax(i,mid)==queryMin(i,mid)){
				l=mid;
				high=mid-1;
			}
			else if(queryMax(i,mid)>queryMin(i,mid)){
				high=mid-1;
			}
			else{
				low=mid+1;
			}
		}
		if(l==-1){
			continue;
		}
		low=i,high=n;
		while(low<=high){
			int mid=(low+high)/2;
			if(queryMax(i,mid)==queryMin(i,mid)){
				r=mid;
				low=mid+1;
			}
			else if(queryMax(i,mid)>queryMin(i,mid)){
				high=mid-1;
			}
			else{
				low=mid+1;
			}
		}
		if(r==-1){
			continue;
		}
		ans+=r-l+1;
	}
	printf("%lld\n",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define int long long
using namespace std;
int n,m;
int st1[210000][30];
int st2[210000][30];
int lg[210000];
int find1(int l,int r){
	int len=r-l+1;
	return max(st1[l][lg[len]],st1[r-(1<<lg[len])+1][lg[len]]);
}
int find2(int l,int r){
	int len=r-l+1;
	return min(st2[l][lg[len]],st2[r-(1<<lg[len])+1][lg[len]]);
}
signed main(){
	scanf("%lld",&n);

	for(int i=1;i<=n;i++){
		scanf("%lld",&st1[i][0]);
		lg[i]=lg[i-1];
		if(i==(2<<lg[i-1])) lg[i]++;
	}
	for(int i=1;i<=n;i++){
		scanf("%lld",&st2[i][0]);
	}
	for(int j=1;(1<<j)<=n;j++){
		for(int i=1;(i+(1<<(j))-1)<=n;i++){
			st2[i][j]=min(st2[i][j-1],st2[i+(1<<(j-1))][j-1]);
		}
	}
	for(int j=1;(1<<j)<=n;j++){
		for(int i=1;(i+(1<<(j))-1)<=n;i++){
			st1[i][j]=max(st1[i][j-1],st1[i+(1<<(j-1))][j-1]);
		}
	}
	int ans=0;
	if(n==71){
	//	cout<<st1[1][0]<<" "<<st1[2][0]<<" "<<st1[3][0]<<" "<<st1[4][0]<<endl;
	//	cout<<st2[1][0]<<" "<<st2[2][0]<<" "<<st2[3][0]<<" "<<st2[4][0]<<endl;
	}
	for(int i=1;i<=n;i++){
		int l=1;
		int r=i;
		while(l<r){
			int mid=(l+r+1)>>1;
			if(find1(mid,i)>find2(mid,i)){
				l=mid;
			}
			else{
				r=mid-1;
			}
		}
		int tmp=l;
		l=1;
		r=i;
		while(l<r){
			int mid=(l+r+1)>>1;
			if(find1(mid,i)>=find2(mid,i)){
				l=mid;
			}
			else{
				r=mid-1;
			}
		}
		ans+=l-tmp;
	}
	cout<<ans<<endl;
	return 0;

}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int N = 200010;
int a[N],b[N];
int st0[N][21],st1[N][21];
int a_query(int l,int r){
	if(l==r){
		return a[l];
	}
	int k=log2(r-l);
	return max(st0[l][k],st0[r-(1<<k)+1][k]);
}
int b_query(int l,int r){
	if(l==r){
		return b[l];
	}
	int k=log2(r-l);
	return min(st1[l][k],st1[r-(1<<k)+1][k]);
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		int t;
		scanf("%d",&t);
		st0[i][0]=a[i]=t;
	}
	for(int i=1;i<=n;i++){
		int t;
		scanf("%d",&t);
		st1[i][0]=b[i]=t;
	}
	for(int j=1;j<=log2(n);j++){
		for(int i=1;i<=n;i++){
			if((i+(1<<(j-1)))>n){
				continue;
			}
			st0[i][j]=max(st0[i][j-1],st0[i+(1<<(j-1))][j-1]);
			st1[i][j]=min(st1[i][j-1],st1[i+(1<<(j-1))][j-1]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		int l=i,r=n;
		int t1,t2;
		while(l<r){
			int mid=(l+r)>>1;
			if(b_query(i,mid)<=a_query(i,mid)){
				r=mid;
			}
			else{
				l=mid+1;
			}
		}
		t1=r;
		l=i,r=n;
		while(l<r){
			int mid=(l+r)>>1;
			if(b_query(i,mid)<a_query(i,mid)){
				r=mid;
			}
			else{
				l=mid+1;
			}
		}
		t2=r;
		if(b_query(i,t1)!=a_query(i,t1) ||
			b_query(i,t2-1)!=a_query(i,t2-1)){
			continue;
		}
		ans+=t2-t1;
		//cout<<i<<' '<<t1<<' '<<t2<<' '<<t2-t1<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define Max(a,b) ((a)>(b)?(a):(b))
#define Min(a,b) ((a)<(b)?(a):(b))
#define int long long
using namespace std;
int n,m;
int st1[210000][30];
int st2[210000][30];
int lg[210000];
int find1(int l,int r){
	int len=r-l+1;
	return max(st1[l][lg[len]],st1[r-(1<<lg[len])+1][lg[len]]);
}
int find2(int l,int r){
	int len=r-l+1;
	return min(st2[l][lg[len]],st2[r-(1<<lg[len])+1][lg[len]]);
}
signed main(){
	scanf("%lld",&n);

	for(int i=1;i<=n;i++){
		scanf("%lld",&st1[i][0]);
		lg[i]=lg[i-1];
		if(i==(2<<lg[i-1])) lg[i]++;
	}
	for(int i=1;i<=n;i++){
		scanf("%lld",&st2[i][0]);
	}
	for(int j=1;(1<<j)<=n;j++){
		for(int i=1;(i+(1<<(j))-1)<=n;i++){
			st2[i][j]=min(st2[i][j-1],st2[i+(1<<(j-1))][j-1]);
		}
	}
	for(int j=1;(1<<j)<=n;j++){
		for(int i=1;(i+(1<<(j))-1)<=n;i++){
			st1[i][j]=max(st1[i][j-1],st1[i+(1<<(j-1))][j-1]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		int l=1;
		int r=i;
		while(l<r){
			int mid=(l+r+1)>>1;
			if(find1(mid,i)>find2(mid,i)){
				l=mid;
			}
			else{
				r=mid-1;
			}
		}
		int tmp=l;
		l=1;
		r=i;
		while(l<r){
			int mid=(l+r+1)>>1;
			if(find1(mid,i)>=find2(mid,i)){
				l=mid;
			}
			else{
				r=mid-1;
			}
		}
		ans+=l-tmp;
	}
	cout<<ans<<endl;
	return 0;

}
/*
5
14 10 6 2 6
22 26 1 12 6
*/


#include <iostream>
#include <cstdio>
using namespace std;
int n;
const int MAXN=200005;
int l[MAXN];
int s[MAXN][31],s2[MAXN][31];
int query(int le,int r){
	int k=l[r-le+1]-1;
	return max(s[le][k],s[r-(1<<k)+1][k]);
}
int query2(int le,int r){
	int k=l[r-le+1]-1;
	return min(s2[le][k],s2[r-(1<<k)+1][k]);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&s[i][0]);
	}
	for(int i=1;i<=n;i++){
		scanf("%d",&s2[i][0]);
	}
	for(int i=1;i<=n;i++){
		l[i]=l[i-1]+((1<<l[i-1])==i);
	}
	for(int j=1;j<20;j++){
		for(int i=1;i+(1<<j)-1<=n;i++){
			s[i][j]=max(s[i][j-1],s[i+(1<<j-1)][j-1]);
		}
	}
	for(int j=1;j<20;j++){
		for(int i=1;i+(1<<j)-1<=n;i++){
			s2[i][j]=min(s2[i][j-1],s2[i+(1<<j-1)][j-1]);
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(s2[i][0]<s[i][0]) continue;
		int left=i,right=n,ansl=-1,ansr=-1;
		while(left<=right){
			int mid=(left+right)/2;
			if(query(i,mid)<query2(i,mid)){
				left=mid+1;
			}else if(query(i,mid)==query2(i,mid)){
				ansl=mid;
				right=mid-1;
			}else{
				right=mid-1;
			}
		}
		if(ansl==-1) continue;
		left=i,right=n;
		while(left<=right){
			int mid=(left+right)/2;
			if(query(i,mid)<query2(i,mid)){
				left=mid+1;
			}else if(query(i,mid)==query2(i,mid)){
				ansr=mid;
				left=mid+1;
			}else{
				right=mid-1;
			}
		}
		if(ansr==-1) continue;
		ans+=(ansr-ansl+1);
//		cout<<ansl<<' '<<ansr<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int N=2e5+10;
int a[N],b[N],sa[N][20],sb[N][20];
int check(int l,int r) {
	int k=log2(r-l+1);
	return max(sa[l][k],sa[r-(1<<k)+1][k])-min(sb[l][k],sb[r-(1<<k)+1][k]);
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		sa[i][0]=a[i];
	}
	for(int i=1;i<=n;i++) {
		scanf("%d",&b[i]);
		sb[i][0]=b[i];
	}
	for(int i=1;(1<<i)<=n;i++) {
		for(int j=1;j+(1<<i)-1<=n;j++) {
			sa[j][i]=max(sa[j][i-1],sa[j+(1<<i-1)][i-1]);
			sb[j][i]=min(sb[j][i-1],sb[j+(1<<i-1)][i-1]);
		}
	}
	long long cnt=0;
	for(int i=1;i<=n;i++) {
		int l=1,r=i;
		while(l<r) {
			int md=((l+r)>>1)+1;
			if(check(md,i)<0) {
				r=md-1;
			} else {
				l=md;
			}
		}
		int kk=l;
		l=1,r=i;
		while(l<r) {
			int md=(l+r)>>1;
			if(check(md,i)>0) {
				l=md+1;
			} else {
				r=md;
			}
		}
//		cout<<kk<<" "<<l<<endl;
		if(l!=kk||check(kk,kk)==0)
			cnt+=l-kk+1;
	}
	cout<<cnt;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int N=2e5+10;
int a[N],b[N],sa[N][20],sb[N][20];
int check(int l,int r) {
	int k=log2(r-l+1);
	return max(sa[l][k],sa[r-(1<<k)+1][k])-min(sb[l][k],sb[r-(1<<k)+1][k]);
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		sa[i][0]=a[i];
	}
	for(int i=1;i<=n;i++) {
		scanf("%d",&b[i]);
		sb[i][0]=b[i];
	}
	for(int i=1;(1<<i)<=n;i++) {
		for(int j=1;j+(1<<i)-1<=n;j++) {
			sa[j][i]=max(sa[j][i-1],sa[j+(1<<i-1)][i-1]);
			sb[j][i]=min(sb[j][i-1],sb[j+(1<<i-1)][i-1]);
		}
	}
	long long cnt=0;
	for(int i=1;i<=n;i++) {
		int l=1,r=i;
		while(l<r) {
			int md=((l+r)>>1)+1;
			if(check(md,i)<0) {
				r=md-1;
			} else {
				l=md;
			}
		}
		int kk=l;
		l=1,r=i;
		while(l<r) {
			int md=(l+r)>>1;
			if(check(md,i)>0) {
				l=md+1;
			} else {
				r=md;
			}
		}
//		cout<<kk<<" "<<l<<endl;
		if(l!=kk||check(kk,kk)==0)
			cnt+=1ll+l-kk;
	}
	cout<<cnt;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
const int N=2e5+10;
int a[N],b[N],sa[N][20],sb[N][20];
int check(int l,int r) {
	int k=log2(r-l+1);
	return max(sa[l][k],sa[r-(1<<k)+1][k])-min(sb[l][k],sb[r-(1<<k)+1][k]);
}
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) {
		scanf("%d",&a[i]);
		sa[i][0]=a[i];
	}
	for(int i=1;i<=n;i++) {
		scanf("%d",&b[i]);
		sb[i][0]=b[i];
	}
	for(int i=1;(1<<i)<=n;i++) {
		for(int j=1;j+(1<<i)-1<=n;j++) {
			sa[j][i]=max(sa[j][i-1],sa[j+(1<<i-1)][i-1]);
			sb[j][i]=min(sb[j][i-1],sb[j+(1<<i-1)][i-1]);
		}
	}
	long long cnt=0;
	for(int i=1;i<=n;i++) {
		int l=1,r=i;
		while(l<r) {
			int md=((l+r)>>1)+1;
			if(check(md,i)<0) {
				r=md-1;
			} else {
				l=md;
			}
		}
		int kk=l;
		l=1,r=i;
		while(l<r) {
			int md=(l+r)>>1;
			if(check(md,i)>0) {
				l=md+1;
			} else {
				r=md;
			}
		}
//		cout<<kk<<" "<<l<<endl;
		if(l!=kk||check(kk,i)==0)
			cnt+=1ll+l-kk;
	}
	cout<<cnt;
}