using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Collections.Generic;
using System.Diagnostics;
using Enu = System.Linq.Enumerable;

public class Program
{
    public void Solve()
    {
        int N = Reader.Int();
        var A = Reader.IntArray(N * 3);
        var sorted = (A.Clone() as int[]).OrderBy(a => a).ToArray();
        var L = new Heap<long>();
        var R = new Heap<long>(true);
        var Lbest = new long[A.Length];
        var Rbest = Enu.Repeat(long.MaxValue, A.Length).ToArray();
        long S = 0;

        for (int i = 0; i < A.Length; i++)
        {
            S += A[i];
            L.Push(A[i]);
            if (i + 1 > N) S -= L.Pop();
            Lbest[i] = S;
        }
        S = 0;
        for (int i = A.Length - 1; i >= 0; i--)
        {
            S += A[i];
            R.Push(A[i]);
            if (A.Length - i > N) S -= R.Pop();
            Rbest[i] = S;
        }
        long ans = long.MinValue;
        for (int i = N - 1; A.Length - i > N; i++)
            ans = Math.Max(ans, Lbest[i] - Rbest[i + 1]);

        Console.WriteLine(ans);
    }
}


public class Heap<T>
{
    const int InitialSize = 1000;
    readonly int sign;
    readonly Comparer<T> comp = Comparer<T>.Default;
    T[] A = new T[InitialSize];
    public int Count { get; private set; }
    public Heap(bool greater = false) { sign = greater ? 1 : -1; }
    public T Peek() { return A[1]; }
    public bool Empty() { return Count == 0; }
    bool Compare(T a, T b) { return Math.Sign(comp.Compare(a, b)) == sign; }

    public void Push(T val)
    {
        int i = ++Count;
        if (i == A.Length) Array.Resize(ref A, A.Length * 2);
        for (; i > 1 && Compare(val, A[i >> 1]); i >>= 1) A[i] = A[i >> 1];
        A[i] = val;
    }

    public T Pop()
    {
        T res = A[1];
        T val = A[Count--];
        if (Count == 0) return res;
        int i = 1;
        for (int L = i << 1, R = L | 1; L <= Count; L = i << 1, R = L | 1)
        {
            if (R <= Count && Compare(A[R], A[L])) L = R;
            if (Compare(A[L], val)) { A[i] = A[L]; i = L; }
            else break;
        }
        A[i] = val;
        return res;
    }
}


class Entry { static void Main() { new Program().Solve(); } }
class Reader
{
    static TextReader reader = Console.In;
    static readonly char[] separator = { ' ' };
    static readonly StringSplitOptions op = StringSplitOptions.RemoveEmptyEntries;
    static string[] A = new string[0];
    static int i;
    static void Init() { A = new string[0]; }
    public static void Set(TextReader r) { reader = r; Init(); }
    public static void Set(string file) { reader = new StreamReader(file); Init(); }
    public static bool HasNext() { return CheckNext(); }
    public static string String() { return Next(); }
    public static int Int() { return int.Parse(Next()); }
    public static long Long() { return long.Parse(Next()); }
    public static double Double() { return double.Parse(Next()); }
    public static int[] IntLine() { return Array.ConvertAll(Split(Line()), int.Parse); }
    public static int[] IntArray(int N) { return Range(N, Int); }
    public static int[][] IntTable(int H) { return Range(H, IntLine); }
    public static string[] StringArray(int N) { return Range(N, Next); }
    public static string[][] StringTable(int N) { return Range(N, () => Split(Line())); }
    public static string Line() { return reader.ReadLine().Trim(); }
    public static T[] Range<T>(int N, Func<T> f) { var r = new T[N]; for (int i = 0; i < N; r[i++] = f()) ; return r; }
    static string[] Split(string s) { return s.Split(separator, op); }
    static string Next() { CheckNext(); return A[i++]; }
    static bool CheckNext()
    {
        if (i < A.Length) return true;
        string line = reader.ReadLine();
        if (line == null) return false;
        if (line == "") return CheckNext();
        A = Split(line);
        i = 0;
        return true;
    }
}

Measured memory_bytes: 52692