#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {

        
        var N = Console.ReadLine().ToInt32();

        var an = Console.ReadLine().SplittedStringToInt64List();
        var prqueue = new PriorityQueue<OddInteger>();
        var firsts = an.Take(N);
        var kals = new long[N + 1];

        var fsummax = -1;
        prqueue.PushRange(firsts.Select(x => new OddInteger(x)));
        kals[0] = firsts.Sum();
        for (int i = N; i < 2*N; i++)
        {
            prqueue.Push(new OddInteger(an[i]));
            var item = prqueue.Pop();
            kals[i - N + 1] = (kals[i - N] + an[i] - item.Num);
            
        }
        var kbls = new long[N + 1];
        var lasts = an.Skip(2 * N);
        var fsummin = LONGINF;
        var prqueueb = new PriorityQueue<long>();
        prqueueb.PushRange(lasts/*.Select(x => new OddInteger(x))*/);
        kbls[N] = lasts.Sum();
        
        for (int i = 2 * N - 1; i >= N; i--)
        {
            prqueueb.Push(an[i]);
            var item = prqueueb.Pop();
            kbls[i - N] = (kbls[i + 1 - N]  + an[i] - item);
            
        }
        var max = -LONGINF;
        for (int i = 0; i <= N; i++)
        {
            max = Math.Max(max, kals[i] - kbls[i]);
        }
        Console.WriteLine(max);

        Console.ReadLine();
    }

    public static void PrintArray<T>(T[,] array)
    {
        for (int i = 0; i < array.GetLength(0); i++)
        {
            for (int j = 0; j < array.GetLength(1); j++)
            {
                Console.Write(array[i, j] + " ");
            }
            Console.WriteLine();
        }
    }


    public struct OddInteger : IComparable<OddInteger>
    {
        public long Num;

        public OddInteger(long num)
        {
            Num = num;
        }

        public int CompareTo(OddInteger other)
        {
            return -Num.CompareTo(other.Num);
        }

        public string ToString() => Num.ToString();
    }

    class PriorityQueue<T> where T : IComparable<T>
    {
        List<T> buffer;

        public PriorityQueue() { buffer = new List<T>(); }
        public PriorityQueue(int capacity) { buffer = new List<T>(capacity); }

        static void PushHeap(List<T> array, T elem)
        {
            int n = array.Count;
            array.Add(elem);

            while (n != 0)
            {
                int i = (n - 1) / 2;
                if (array[n].CompareTo(array[i]) > 0)
                {
                    T tmp = array[n]; array[n] = array[i]; array[i] = tmp;
                }
                n = i;
            }
        }


        static void PopHeap(List<T> array)
        {
            int n = array.Count - 1;
            array[0] = array[n];
            array.RemoveAt(array.Count - 1);

            for (int i = 0, j; (j = 2 * i + 1) < n;)
            {
                if ((j != n - 1) && (array[j].CompareTo(array[j + 1]) < 0))
                    j++;
                if (array[i].CompareTo(array[j]) < 0)
                {
                    T tmp = array[j]; array[j] = array[i]; array[i] = tmp;
                }
                i = j;
            }
        }


        public void Push(T elem)
        {
            PushHeap(this.buffer, elem);
        }
        public void PushRange(IEnumerable<T> elems)
        {
            foreach (var item in elems)
            {
                PushHeap(this.buffer, item);
            }
        }


        public T Pop()
        {
            var data = buffer[0];
            PopHeap(buffer);
            return data;
        }

        public int Count
        {
            get { return buffer.Count; }
        }
    }

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<long> SplittedStringToInt64List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;

    public static int Max(params int[] values)
    {
        var maxes = -1;
        for (int i = 0; i < values.Length; i++)
        {
            maxes = Math.Max(values[i], maxes);
        }
        return maxes;
    }

    #endregion
}



Measured memory_bytes: 41956