#include <algorithm>
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> parts_a(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> parts_a[n];
  }
  sort(parts_a.begin(), parts_a.end());
  
  vector<int64_t> parts_b(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> parts_b[n];
  }
  
  vector<int64_t> parts_c(N);
  for (int64_t n = 0; n < N; ++n) {
    cin >> parts_c[n];
  }
  sort(parts_c.begin(), parts_c.end());
  
  int64_t result = 0;
  for (int64_t n = 0; n < N; ++n) {
    auto it = lower_bound(parts_a.begin(), parts_a.end(), parts_b[n]);
    int64_t a_num = (it - parts_a.begin());
    auto it2 = upper_bound(parts_c.begin(), parts_c.end(), parts_b[n]);
    int64_t b_num = (parts_c.end() - it2);
    result += a_num * b_num;
  }
  cout << result << endl;
  
  return 0;
}

#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    vector<ll> a(n);

    ll cnt = 0;

    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] < 0)
            cnt++;
    }

    for (ll i = 0; i < n; i++)
    {
        if (a[i] < 0)
            a[i] *= -1;
    }
    
    if (cnt % 2 == 1)
    {
        sort(ALL(a));
        a[0] *= -1;
    }

    ll ans = 0;
    for (ll i = 0; i < n; i++)
    {
        ans += a[i];
    }
    cout << ans << endl;
}