#include <bits/stdc++.h>

//_ ************************** Advanced PBDS ***********************************
 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<class T>
using ordered_set = tree<
    T,
    null_type,
    less<T>,
    rb_tree_tag,
    tree_order_statistics_node_update
>;
 
 
//_ ****************************************************************************
 
#define int              long long int
#define double           long double
#define print(a)         for(auto x : a) cout << x << " "; cout << endl


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int LINF = 2000000000000000001;

inline int power(int a, int b, int mod=M) {
    int x = 1;
    a %= mod;
    while (b) {
        if (b & 1) x = (x * a) % mod; 
        a = (a * a) % mod;
        b >>= 1;
    }
    return x;
}


//_ ***************************** START Below *******************************




vector<int> a;
vector<int> b;

int consistency(int n, int c, int d){

	ordered_set<pair<int,int>> st;
	
	int ans = 0;

	for(int i=0; i<n; i++){
		int diff = a[i] - b[i];
		int k = c-d;
		
		
		ans += st.size() - st.order_of_key({ diff + k, -LINF});
		
		st.insert({diff, i});
	}
	
	return ans;
}















int practice(int n, int c, int d){


    return 0;
}





void solve() {
    
    int n, c, d;
    cin>> n >> c >> d;
    
    a.resize(n);
    b.resize(n);
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<n; i++) cin >> b[i];
    
    cout << consistency(n, c, d) << endl;


}





int32_t main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}