import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main() {
  int n = readln.chomp.to!int;
  long[] a = readln.chomp.split.map!(to!long).array;
  long left = 0;
  foreach (v; a[0..n]) {
    left += v;
  }
  long right = 0;
  foreach (v; a[2*n..$]) {
    right += v;
  }
  alias Node = Tuple!(long, "value", ulong, "index");
  Node[] leftArray = new Node[](n);
  foreach (i, v; a[0..n]) {
    leftArray[i] = Node(v, i);
  }
  std.algorithm.sort!((a, b) => a < b)(leftArray);
  Node[] rightArray = new Node[](n);
  foreach (i, v; a[2*n..$]) {
    rightArray[i] = Node(v, i + 2*n);
  }
  std.algorithm.sort!((a, b) => a > b)(rightArray);
  long[] sum = new long[](n + 1);
  sum[0] = right;
  for (int i = 0; i < n; ++i) {
    immutable addTargetIndex = 2 * n - 1 - i;
    // i + 1個右から消す
    long deleteTarget = rightArray[i].value;
    right -= deleteTarget;
    right += a[addTargetIndex];
    sum[i + 1] = right;
  }
  // stderr.writeln = sum;
  long[] sumMin = new long[](n + 1);
  sumMin[0] = sum[0]; // n 個消したとき
  for (int i = 0; i < n; ++i) {
    // 1 ~ n - (i + 1) 消す中で最小
    sumMin[i + 1] = min(sumMin[i], sum[i + 1]);
  }
  // stderr.writeln = sumMin;
  long ans = left - sumMin[n];
  for (int i = 1; i <= n; ++i) {
    // i個左から消す
    left -= leftArray[i - 1].value;
    left += a[n + i - 1];
    // j個右から最小になるように消す
    int j = n - i;
    ans = max(ans, left - sum[j]);
  }
  ans.writeln;
}
