#include <bits/stdc++.h>
using namespace std;

#define int long long

const long double PI = 3.14159265359;

template <class T>
struct BIT
{
    // 1-indexed
    int n;
    vector<T> t;

    BIT()
    {
    }

    BIT(int _n)
    {
        n = _n;
        t.assign(n + 1, 0);
    }

    T query(int i)
    {
        T ans = 0;
        for (; i >= 1; i -= (i & -i))
            ans += t[i];
        return ans;
    }

    void upd(int i, T val)
    {
        if (i <= 0)
            return;
        for (; i <= n; i += (i & -i))
            t[i] += val;
    }
    void upd(int l, int r, T val)
    {
        upd(l, val);
        upd(r + 1, -val);
    }
    T query(int l, int r)
    {
        return query(r) - query(l - 1);
    }
};

void solve()
{
    int n, l, r;
    cin >> n >> l >> r;
    vector<int> arr(n);
    for (auto &val : arr)
        cin >> val;

    vector<int> pref(n + 1, 0);
    for (int i = 1; i <= n; i++)
        pref[i] = pref[i - 1] + arr[i - 1];

    BIT<int> bit(n + 5);
    vector<int> vals = pref;

    sort(vals.begin(), vals.end());
    vals.erase(unique(vals.begin(), vals.end()), vals.end());

    int first = lower_bound(vals.begin(), vals.end(), pref[0]) - vals.begin();
    bit.upd(first + 1, 1);

    int ans = 0;
    for (int i = 1; i <= n; i++)
    {
        int low = pref[i] - r;
        int high = pref[i] - l;

        int low_cond = lower_bound(vals.begin(), vals.end(), low) - vals.begin();
        int high_cond = upper_bound(vals.begin(), vals.end(), high) - vals.begin();

        ans += (bit.query(high_cond) - bit.query(low_cond));

        int new_pref_cond = lower_bound(vals.begin(), vals.end(), pref[i]) - vals.begin();
        bit.upd(new_pref_cond + 1, 1);
    }
    cout << ans << '\n';
}

signed main(void)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if (fopen("input.txt", "r"))
    {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}