using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp80
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            List<int> l = new List<int>();
            int[] t1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] t2 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            l.AddRange(t1);
            l.AddRange(t2);
            int[] nums = new int[2001];
            for (int i = 0; i < l.Count; i++)
            {
                nums[l[i]]++;
            }
            int counter = 0;
            for (int i = 0; i <l.Count ; i++)
            {
                for (int j = 0; j < l.Count; j++)
                {
                    int y = (l[i] + l[j]) % 2;
                    if (nums[y]>0)
                    {
                        counter++;
                    }
                }
            }
            if (counter%2==0)
            {
                Console.WriteLine("Karen");
            }
            else
                Console.WriteLine("Koyomi");
        }

    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var xArray = sr.ReadArrayOfInt64();
            var yArray = sr.ReadArrayOfInt64();
            var free = new List<int>();
            var busy = new int[2 * n + 1];
            for (var i = 0; i < n; i++) {
                busy[xArray[i]]++;
                busy[yArray[i]]++;
            }
            for (var i = 1; i < busy.Length; i++) {
                if (busy[i] > 1)
                    free.Add(i);
            }
            var freeIndx = 0;
            for (var i = 0; i < xArray.Length; i++) {
                if (busy[xArray[i]] > 1) {
                    xArray[i] = free[freeIndx];
                    freeIndx++;
                    busy[xArray[i]]--;
                }
            }
            var count = 0;
            for (var i = 0; i < xArray.Length; i++) {
                for (var j = 0; j < yArray.Length; j++) {
                    var r = xArray[i] ^ yArray[j];
                    if(r <= 2L*n)
                    {
                        count++;
                    }
                }
            }

            if (count % 2 == 0) {
                sw.WriteLine("Karen");
            }
            else {
                sw.WriteLine("Koyomi");

            }
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var xArray = sr.ReadArrayOfInt64();
            var yArray = sr.ReadArrayOfInt64();
            var free = new List<int>();
            var busy = new int[2 * n + 1];
            for (var i = 0; i < n; i++) {
                busy[xArray[i]]++;
                busy[yArray[i]]++;
            }
            for (var i = 1; i < busy.Length; i++) {
                if (busy[i] > 1)
                    free.Add(i);
            }
            var freeIndx = 0;
            for (var i = 0; i < xArray.Length; i++) {
                if (busy[xArray[i]] > 1) {
                    var old = xArray[i];
                    xArray[i] = free[freeIndx];
                    freeIndx++;
                    busy[old]--;
                }
                if (busy[yArray[i]] > 1) {
                    var old = yArray[i];
                    yArray[i] = free[freeIndx];
                    freeIndx++;
                    busy[old]--;
                }
            }
            var count = 0;
            for (var i = 0; i < xArray.Length; i++) {
                for (var j = 0; j < yArray.Length; j++) {
                    var r = xArray[i] ^ yArray[j];
                    if(r <= 2L*n)
                    {
                        count++;
                    }
                }
            }

            if (count % 2 == 0) {
                sw.WriteLine("Karen");
            }
            else {
                sw.WriteLine("Koyomi");

            }
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//			using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var xArray = sr.ReadArrayOfInt64();
            var yArray = sr.ReadArrayOfInt64();
            var free = new List<int>();
            var busy = new int[2 * n + 1];
            for (var i = 0; i < n; i++) {
                busy[xArray[i]]++;
                busy[yArray[i]]++;
            }
            for (var i = 1; i < busy.Length; i++) {
                if (busy[i] == 0)
                    free.Add(i);
            }
            var freeIndx = 0;
            for (var i = 0; i < xArray.Length; i++) {
                if (busy[xArray[i]] > 1) {
                    var old = xArray[i];
                    xArray[i] = free[freeIndx];
                    freeIndx++;
                    busy[old]--;
                }
                if (busy[yArray[i]] > 1) {
                    var old = yArray[i];
                    yArray[i] = free[freeIndx];
                    freeIndx++;
                    busy[old]--;
                }
            }
            var count = 0;
            for (var i = 0; i < xArray.Length; i++) {
                for (var j = 0; j < yArray.Length; j++) {
                    var r = xArray[i] ^ yArray[j];
                    if(r <= 2L*n)
                    {
                        count++;
                    }
                }
            }

            if (count % 2 == 0) {
                sw.WriteLine("Karen");
            }
            else {
                sw.WriteLine("Koyomi");

            }
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        var a = ReadIntArray();
        var b = ReadIntArray();

        var c = new bool[3000000];
        foreach (int x in a)
            c[x] = true;
        foreach (int x in b)
            c[x] = true;

        bool ans = false;
        foreach (int aa in a)
            foreach (int bb in b)
                if (c[aa ^ bb])
                    ans = !ans;

        Write(ans ? "Koyomi" : "Karen");
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        //reader = new StreamReader(Console.OpenStandardInput());
        //writer = new StreamWriter(Console.OpenStandardOutput());
        reader = new StreamReader("input.txt");
        writer = new StreamWriter("output.txt");
#endif
        try
        {
            new Solver().Solve();
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
#if __debug
            var n = Convert.ToInt32("3");
            var n1 = "1 2 3".Split(' ').Select(nn => Convert.ToInt32(nn));
            var n2 = "4 5 6".Split(' ').Select(nn => Convert.ToInt32(nn));
#else
            var n = Convert.ToInt32(Console.ReadLine());
            var n1 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();
            var n2 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();
#endif

            Console.WriteLine(Check(n1, n2));
        }

        static string Check(IEnumerable<int> n1, IEnumerable<int> n2)
        {
            int pairs = 0;
            foreach (var nn in n1)
            {
                foreach (var nnn in n2)
                {
                    int kkk = nn ^ nnn;
#if __debug
Console.WriteLine($"nn={nn} nnn={nnn} xor={kkk}");
#endif
                    if (n1.Contains(kkk) || n2.Contains(kkk)) pairs++;
                }
            }
#if __debug
Console.WriteLine($"k={Koyomi} ky={Karen}");
#endif
            return pairs % 2 != 0 ? "Koyomi" : "Karen";
        }
    }
}


using System;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    static char[] SPACE = new[] { ' ' };

    static void Main(string[] args)
    {
#if DEBUG
        using (var input = new StreamReader("input.txt"))
        using (var output = new StreamWriter("output.txt"))
        {
            Console.SetIn(input);
            Console.SetOut(output);

            int n = 0;
            do
            {
                Console.WriteLine();
                Console.WriteLine("Sample {0}", ++n);
                Prog();
            } while (Console.ReadLine() == string.Empty);
        }
#else
            Prog();
#endif
    }

    static int __ptr = 0;
    static string[] __input;
    static int NextInt()
    {
        return int.Parse(__input[__ptr++]);
    }
    static long NextLong()
    {
        return long.Parse(__input[__ptr++]);
    }
    static void ReadTokens(int n)
    {
        __ptr = 0;
        __input = Console.ReadLine().Split(SPACE, n);
    }

    //

    static void Prog()
    {
        ReadTokens(1);
        var n = NextInt();

        int[] a = new int[n];
        int[] b = new int[n];

        int[] all = new int[n * 2];

        ReadTokens(n);
        for (int i = 0; i < n; i++)
            a[i] = all[i] = NextInt();

        ReadTokens(n);
        for (int i = 0; i < n; i++)
            b[i] = all[n + i] = NextInt();

        int count = 0;

        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
            {
                for (int p = 0; p < all.Length; p++)
                {
                    if ((a[i] ^ b[j]) == all[p])
                    {
                        count++;
                        break;
                    }
                }
            }

        Console.WriteLine((count % 2 == 0) ? "Karen" : "Koyomi");
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TaskH
{
    class Program
    {
        static bool Tof(int val, int[] x, int[] y)
        {
            foreach (int element in x)
                if (val == element)
                    return true;
            foreach (int element in y)
                if (val == element)
                    return true;
            return false;
        }

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int count = 0;
            string name = "Koyomi";
            var x = Array.ConvertAll(Console.ReadLine().Split(' '), t => Int32.Parse(t));
            var y = Array.ConvertAll(Console.ReadLine().Split(' '), t => Int32.Parse(t));
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    if (Tof(x[i] ^ y[j], x, y))
                        count++;
            if (count % 2 == 0)
                name = "Karen";
            Console.WriteLine(name);
        }
    }
}


//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
#if __debug
            var n = Convert.ToInt32("3");
            var n1 = "2 4 6 8 10".Split(' ').Select(nn => Convert.ToInt32(nn));
            var n2 = "9 7 5 3 1".Split(' ').Select(nn => Convert.ToInt32(nn));
#else
            var n = Convert.ToInt32(Console.ReadLine());
            var n1 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();
            var n2 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();
#endif

            Console.WriteLine(Check(n1, n2));
        }

        static string Check(IEnumerable<int> n1, IEnumerable<int> n2)
        {
            List<int> l = new List<int>();
            l.AddRange(n1);
            l.AddRange(n2);
            int half = l.Count / 2;
            int pairs = 0;
            for (int i = 0; i < half; i++)
            {
                for (int j = half; j < half*2; j++)
                {
#if __debug
                    Console.WriteLine($"nn={l[i]} nnn={l[j]} xor={l[i] ^ l[j]}");
#endif
                    if (l.Contains(l[i] ^ l[j])) pairs++;
                }
            }

            /*
            foreach (var nn in n1)
            {
                foreach (var nnn in n2)
                {
                    int kkk = nn ^ nnn;
#if __debug
Console.WriteLine($"nn={nn} nnn={nnn} xor={kkk}");
#endif
                    if (n1.Contains(kkk) || n2.Contains(kkk)) pairs++;
                }
            }

*/
#if __debug
            Console.WriteLine($"pairs={pairs}");
#endif
            return pairs % 2 != 0 ? "Koyomi" : "Karen";
        }
    }
}


using System;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    static char[] SPACE = new[] { ' ' };

    static void Main(string[] args)
    {
#if DEBUG
        using (var input = new StreamReader("input.txt"))
        using (var output = new StreamWriter("output.txt"))
        {
            Console.SetIn(input);
            Console.SetOut(output);

            int n = 0;
            do
            {
                Console.WriteLine();
                Console.WriteLine("Sample {0}", ++n);
                Prog();
            } while (Console.ReadLine() == string.Empty);
        }
#else
            Prog();
#endif
    }

    static int __ptr = 0;
    static string[] __input;
    static int NextInt()
    {
        return int.Parse(__input[__ptr++]);
    }
    static long NextLong()
    {
        return long.Parse(__input[__ptr++]);
    }
    static void ReadTokens(int n)
    {
        __ptr = 0;
        __input = Console.ReadLine().Split(SPACE, n);
    }

    //

    static void Prog()
    {
        ReadTokens(1);
        var n = NextInt();

        int[] a = new int[n];
        int[] b = new int[n];

        int[] all = new int[n * 2];

        ReadTokens(n);
        for (int i = 0; i < n; i++)
            a[i] = all[i] = NextInt();

        ReadTokens(n);
        for (int i = 0; i < n; i++)
            b[i] = all[n + i] = NextInt();

        Array.Sort(all);

        int count = 0;

        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                if (Array.IndexOf(all, (a[i] ^ b[j])) > -1)
                    count++;

        Console.WriteLine((count % 2 == 0) ? "Karen" : "Koyomi");
    }
}


//#define __debug

using System;
using System.Collections.Generic;
using System.Linq;

namespace _TestData
{
    public static class TestExtensions
    {
        public static string ToStr(this IEnumerable<string> ms)
        {
            return ms.Aggregate("", (current, s) => current + (s + ","));
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
#if __debug
            var n = Convert.ToInt32("3");
            var n1 = "1 2 3".Split(' ').Select(nn => Convert.ToInt32(nn));
            var n2 = "4 5 6".Split(' ').Select(nn => Convert.ToInt32(nn));
#else
            var n = Convert.ToInt32(Console.ReadLine());
            var n1 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();
            var n2 = Console.ReadLine().Split(' ').Select(nn => Convert.ToInt32(nn)).ToList();
#endif

            Console.WriteLine(Check(n1, n2));
        }

        static string Check(IEnumerable<int> n1, IEnumerable<int> n2)
        {
            int Koyomi = 0;
            int Karen = 0;
            foreach (var nn in n1)
            {
                foreach (var nnn in n2)
                {
                    int kkk = nn ^ nnn;
#if __debug
Console.WriteLine($"nn={nn} nnn={nnn} xor={kkk}");
#endif
                    if (n1.Contains(kkk)) Koyomi++;
                    else if (n2.Contains(kkk)) Karen++;
                }
            }
#if __debug
Console.WriteLine($"k={Koyomi} ky={Karen}");
#endif
            return Koyomi > Karen ? "Koyomi" : "Karen";
        }
    }
}


using System;
using System.Collections.Generic;

namespace CodeForces
{
    class Program
    {
        public static void Main()
        {
            var n = GetInt();
            var l = GetInt();
            var r = GetInt();
            var x = GetInt();
            var array = GetIntArray(n);

            var limit = 1 << n;
            var count = 0;

            for (int i = 0; i < limit; i++)
            {
                if (IsAvailable(array, i, l, r, x))
                {
                    count++;
                }
            }

            Console.Write(count);
        }

        private static bool IsAvailable(int[] array, int mask, int l, int r, int x)
        {
            var min = int.MaxValue;
            var max = 0;
            var sum = 0;
            var count = 0;

            for (int i = 0; mask != 0; mask >>= 1, i++)
            {
                if ((mask & 1) == 1)
                {
                    var cost = array[i];
                    min = Math.Min(min, cost);
                    max = Math.Max(max, cost);
                    sum += cost;
                    count++;
                }
            }

            return count >= 2
                && sum >= l
                && sum <= r
                && (max - min) >= x;
        }

        private static int[] GetIntArray(int count)
        {
            var result = new int[count];
            for (int i = 0; i < count; i++)
            {
                result[i] = GetInt();
            }

            return result;
        }

        private static int GetInt()
        {
            int ch = Console.Read();

            while (ch < '0' || ch > '9')
            {
                ch = Console.Read();
            }

            int current = 0;
            while (ch >= '0' && ch <= '9')
            {
                current = (current * 10) + (ch - '0');
                ch = Console.Read();
            }

            return current;
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Round306
{
    class Program
    {
        #region Common Helper

        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }

        #endregion

        #region Problem A

        private static bool ProblemAHelper(string s, string input, string reverse)
        {
            var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);
            if (indexAB == -1)
                return false;
            if (indexAB == 0)
            {
                if (s.Length < 4)
                {
                    return false;
                }
                if (s.Substring(2, s.Length - 2).Contains(reverse))
                {
                    return true;
                }
            }
            else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))
            {
                return true;
            }
            return false;
        }

        private static void ProblemA()
        {
            var s = Console.ReadLine();
            if (ProblemAHelper(s, "AB", "BA") || ProblemAHelper(s, "BA", "AB"))
            {
                Console.WriteLine("YES");
                return;
            }

            Console.WriteLine("NO");
        }

        private static void TwoSubstring()
        {
            var s = Console.ReadLine();
            var subA = "AB";

            var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);
            if (indexA == -1)
            {
                Console.WriteLine("NO");
                return;
            }

            var subB = "BA";
            var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);
            if (indexB == -1)
            {
                Console.WriteLine("NO");
                return;
            }
            if (indexA + 1  < indexB)
            {
                Console.WriteLine("YES");
                return;
            }

            indexA = s.LastIndexOf(subA);
            indexB = s.IndexOf(subB);
            if (indexB + 1 < indexA)
            {
                Console.WriteLine("YES");
                return;
            }

            Console.WriteLine("NO");
        }

        private static void TwoSubstring2()
        {
            var s = Console.ReadLine();
            Console.WriteLine(s.Contains("AB") && s.Contains("BA") &&
            (s.LastIndexOf("BA", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf("AB", StringComparison.OrdinalIgnoreCase) ||
             s.LastIndexOf("AB", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf("BA", StringComparison.OrdinalIgnoreCase))
                ? "YES": "NO");
        }

        #endregion

        #region Problem B

        private static IEnumerable<List<int>> powerSet(IList<int> input, int n = 1)
        {
            var data = input.ToArray();
            for (var i = 0; i < ((n + 1) << (data.Length-1)); i++)
            {
                var tempList = new List<int>(n + 1);
                //tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));
                tempList.AddRange(data.Where((t, j) => (i & (1 << j)) != 0));
                /*for (var j = 0; j < data.Length; j++)
                {
                    if ((i & (1 << j)) !=0)
                    { tempList.Add(data[j]);}
                }*/
                yield return tempList;
            }

        }

        private static void TestPowerSet()
        {
            var r = powerSet(new[] { 1, 2, 3 });
            foreach (var i in r)
            {
                foreach (var re in i)
                    Console.Write(re);
                Console.WriteLine();
            }
        }

        private static void ProblemB()
        {
            var n = Next();
            var l = Next();
            var r = Next();
            var x = Next();
            var c = new int[n];
            for (var i = 0; i < n; i++)
                c[i] = Next();

            //reader.Close();
            var ans = 0;
            var total = 2 << (n - 1);
            for (var i = 0; i < total; i++)
            {
                var min = int.MaxValue;
                var max = 0;
                var sum = 0;
                //var count = 0;
                for (var j = 0; j < n; j++)
                {
                    //if ((i >> j)%2 == 1)
                    if ((i & (1 <<j)) != 0)
                    {
                        sum += c[j];
                        if (sum > r)
                            break;
                        max = Math.Max(max, c[j]);

                        min = Math.Min(min, c[j]);
                        //count++;
                    }
                }
                if (sum <= r && sum >= l && max - min >= x)
                  ans++;
            }

            Console.WriteLine(ans);
        }

        #endregion
        static void Main(string[] args)
        {
            //ProblemA();
            //TwoSubstring();
            //TwoSubstring2();

            ProblemB();

            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Security.Cryptography;

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Point
		{
			public int x;

			public int y;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string getString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static List<long> getLongList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(long.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static long getLong()
		{
			var s = Console.ReadLine();
			return long.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Edge
		{
			public int v;

			public int w;
		}

		public class Vertex
		{
			public List<Edge> edges;

			public int ct;

			public bool was;
		}

		public static bool canAuto(string s, string s1)
		{
			var l = 0;
			for (var i = 0; i < s1.Length; ++i)
			{
				while (l < s.Length && s[l] != s1[i])
					l++;
				if (l == s.Length)
					return false;
				l++;
			}
			return true;
		}

		public static bool canArray(string s, string s1)
		{
			var l = s.ToCharArray().ToList();
			var l1 = s1.ToCharArray().ToList();
			l.Sort();
			l1.Sort();
			if (l.Count != l1.Count)
				return false;

			for (var i = 0; i < l.Count; ++i)
				if (l[i] != l1[i])
					return false;

			return true;
		}

		public static bool canBoth(string s, string s1)
		{
			var l = s.ToCharArray().ToList();
			var l1 = s1.ToCharArray().ToList();
			l.Sort();
			l1.Sort();
			var ll = 0;
			for (var i = 0; i < l1.Count; ++i)
			{
				while (ll < l.Count && l[ll] != l1[i])
					ll++;
				if (ll == l.Count)
					return false;
				ll++;
			}

			return true;
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/
			var ar = getList();
			var n = ar[0];
			var l = ar[1];
			var r = ar[2];
			var x = ar[3];
			ar = getList();
			ar.Sort();
			var ans = 0;
			var tasks = new List<bool> { false, false, false, false, false, false, false, false, false, false, false, false, false, false, false };
			for (var i = 1; i <= (2 << (n - 1)) - 1; ++i)
			{
				var j = i;
				var q = 0;
				while (j != 0)
				{
					tasks[q] = false;
					if (j % 2 == 1)
						tasks[q] = true;
					j /= 2;
					q++;
				}
				var min = 10000000;
				var max = 0;
				var sum = 0;
				var ct = 0;
				for (var e = 0; e < 15; ++e)
				{
					if (tasks[e])
					{
						sum += ar[e];
						ct++;
						min = Min(min, ar[e]);
						max = Max(max, ar[e]);
					}
				}
				if (ct >= 2 && sum >= l && sum <= r && max - min >= x)
					ans++;
			}
			Console.WriteLine(ans);
			Console.ReadLine();
		}
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;
using System.Globalization;
using System.Threading;

namespace probleme {
    class Program {
        static int[] sum = new int[(1 << 15)];
        static int[] min = new int[(1 << 15)];
        static int[] max = new int[(1 << 15)];
        static int[] c = new int[15];
        static void dp(int number) {
            int exp = -1, aux = number;
            while (aux > 0) {
                aux /= 2;
                exp++;
            }
            aux = number - (1 << exp);
            sum[number] = sum[aux] + c[exp];
            max[number] = Math.Max(max[aux], c[exp]);
            min[number] = Math.Min(min[aux], c[exp]);
            if (min[number] == 0) {
                min[number] = c[exp];
            }
        }
        static void Main(string[] args) {
            //Console.SetIn(new StreamReader("file.txt"));
            string[] s = Console.ReadLine().Split(' ');
            int n = int.Parse(s[0]), l = int.Parse(s[1]), r = int.Parse(s[2]), x = int.Parse(s[3]);
            c = Array.ConvertAll(Console.ReadLine().Split(' '), tz => int.Parse(tz));
            int vm = (1 << n), ans = 0;
            for (int i = 1; i < vm; i++) {
                dp(i);
                if (sum[i] >= l && sum[i] <= r && (max[i] - min[i]) >= x) {
                    ans++;
                }
            }
            Console.Write(ans);
            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Round306
{
    class Program
    {
        #region Common Helper

        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }

        #endregion

        #region Problem A

        private static bool ProblemAHelper(string s, string input, string reverse)
        {
            var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);
            if (indexAB == -1)
                return false;
            if (indexAB == 0)
            {
                if (s.Length < 4)
                {
                    return false;
                }
                if (s.Substring(2, s.Length - 2).Contains(reverse))
                {
                    return true;
                }
            }
            else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))
            {
                return true;
            }
            return false;
        }

        private static void ProblemA()
        {
            var s = Console.ReadLine();
            if (ProblemAHelper(s, "AB", "BA") || ProblemAHelper(s, "BA", "AB"))
            {
                Console.WriteLine("YES");
                return;
            }

            Console.WriteLine("NO");
        }

        private static void TwoSubstring()
        {
            var s = Console.ReadLine();
            var subA = "AB";

            var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);
            if (indexA == -1)
            {
                Console.WriteLine("NO");
                return;
            }

            var subB = "BA";
            var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);
            if (indexB == -1)
            {
                Console.WriteLine("NO");
                return;
            }
            if (indexA + 1  < indexB)
            {
                Console.WriteLine("YES");
                return;
            }

            indexA = s.LastIndexOf(subA);
            indexB = s.IndexOf(subB);
            if (indexB + 1 < indexA)
            {
                Console.WriteLine("YES");
                return;
            }

            Console.WriteLine("NO");
        }

        private static void TwoSubstring2()
        {
            var s = Console.ReadLine();
            Console.WriteLine(s.Contains("AB") && s.Contains("BA") &&
            (s.LastIndexOf("BA", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf("AB", StringComparison.OrdinalIgnoreCase) ||
             s.LastIndexOf("AB", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf("BA", StringComparison.OrdinalIgnoreCase))
                ? "YES": "NO");
        }

        #endregion

        #region Problem B

        private static IEnumerable<List<int>> powerSet(IList<int> input, int n = 1)
        {
            var data = input.ToArray();
            for (var i = 0; i < ((n + 1) << data.Length); i++)
            {
                var tempList = new List<int>(n + 1);
                tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));
                yield return tempList;
            }

        }

        private static void ProblemB()
        {
            var n = Next();
            var l = Next();
            var r = Next();
            var x = Next();
            var c = new int[n];
            for (var i = 0; i < n; i++)
                c[i] = Next();

            reader.Close();
            var ans = 0;
            var total = 2 << (n - 1);
            for (var i = 0; i < total; i++)
            {
                var min = int.MaxValue;
                var max = 0;
                var sum = 0;
                var count = 0;
                //var tempList = c.Where((t, j) => (i1 >> j)%2 == 1).ToArray();
                for (var j = 0; j < n; j++)
                {
                    if ((i >> j)%2 == 1)
                    {
                        sum += c[j];
                        max = Math.Max(max, c[j]);
                        min = Math.Min(min, c[j]);
                        count++;
                    }
                }
                //if (tempList.Length > 1 && tempList.Sum() >= l && tempList.Sum() <= r && tempList.Max() - tempList.Min() >= x)
                if (count > 1 && sum <= r && sum >= l && max - min >= x)
                  ans++;
            }

            Console.WriteLine(ans);
        }

        #endregion
        static void Main(string[] args)
        {
            //ProblemA();
            //TwoSubstring();
            //TwoSubstring2();

            ProblemB();
            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
    public static class MainClass
    {

        static int ReadIntLine()
        {
            return int.Parse(Console.ReadLine());
        }

        static void ReadInt(ref int a)
        {
            a = ReadIntArrayLine()[0];
        }

        static void ReadInts(ref int a, ref int b)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1];
        }

        static void ReadInts(ref int a, ref int b, ref int c)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4];
        }

        static void ReadInts(ref int a, ref int b, ref int c, ref int d, ref int e, ref int f)
        {
            var x = ReadIntArrayLine();
            a = x[0]; b = x[1]; c = x[2]; d = x[3]; e = x[4]; f = x[5];
        }

        static int[] ReadIntArrayLine()
        {
            char[] sep = { ' ' };
            return Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        static void PrintLn(object obj)
        {
            Console.WriteLine(obj.ToString());
        }

        public static string Reverse(string s)
        {
            char[] charArray = s.ToCharArray();
            Array.Reverse(charArray);
            return new string(charArray);
        }

        public static void PrintLnCollection<T>(IEnumerable<T> col)
        {
            PrintLn(string.Join(" ", col));
        }

        public static void PrintLn(params object[] v)
        {
            PrintLnCollection(v);
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }

        public static string MySubstring(this string str, int start, int finish)
        {
            if (start > finish) return "";
            return str.Substring(start, finish - start + 1);
        }

        public static bool IsInRange(this int a, int lb, int ub)
        {
            return (a >= lb) && (a <= ub);
        }

        private static void mergeDS(int i, int j, int[] a)
        {
            int t = a[j];
            for (int ii = 0; ii < a.Length; ii++)
            {
                if (a[ii] == t)
                    a[ii] = a[i];
            }
        }

        private static T MyMax<T>(params T[] a)
        {
            return a.Max();
        }

        private static T MyMin<T>(params T[] a)
        {
            return a.Min();
        }

        private static int[] GetPrimesLessThan(int x)
        {
            if (x < 2)
                return new int[0];

            int[] a = new int[x];

            a[0] = 1; a[1] = 1;

            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] == 0)
                    for (int j = 2 * i; j < a.Length; j += i)
                    {
                        a[j] = 1;
                    }
            }

            var abc = new List<int>(x);

            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] == 0)
                    abc.Add(i);
            }

            return abc.ToArray();
        }

        private static int FindNearestLEQElementInTheArray(int[] a, int startIndex, int endIndex, int target)
        {
            if (startIndex == endIndex)
            {
                if (a[startIndex] <= target)
                    return startIndex;
                else
                    return -1;
            }

            if (startIndex + 1 == endIndex)
            {
                if (a[endIndex] <= target)
                    return endIndex;
                else if (a[startIndex] <= target)
                    return startIndex;
                else
                    return -1;
            }

            int mid = (startIndex + endIndex) / 2;
            if (target == a[mid])
                return mid;
            else if (target < a[mid])
                return FindNearestLEQElementInTheArray(a, startIndex, mid - 1, target);
            else
                return FindNearestLEQElementInTheArray(a, mid, endIndex, target);
        }

        private static int FindNearestLEQElementInTheArray(int[] a, int target)
        {
            return FindNearestLEQElementInTheArray(a, 0, a.Length - 1, target);
        }

        private static int gcd(int a, int b)
        {
            int r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }

        private static int[] cntChars(string a)
        {

            int[] ans = new int[26];

            for (int i = 0; i < a.Length; i++)
            {
                ans[a[i] - 'a'] = 0;
            }

            for (int i = 0; i < a.Length; i++)
            {
                ans[a[i] - 'a']++;
            }

            return ans;
        }

        static bool canFit(int a1, int b1, int a2, int b2)
        {
            int[] r1 = { a1, b1 };
            int[] r2 = { a2, b2 };

            Array.Sort(r1);
            Array.Sort(r2);

            bool ans = (r1[0] <= r2[0]) && (r1[1] <= r2[1]);

            return ans;

        }

        class Pair
        {
            public int first { get; set; }
            public int second { get; set; }
        }

        //----------------------------------------------------------------------------

        static string GetSha1(string filePath)
        {
            using (FileStream fs = new FileStream(filePath, FileMode.Open))
            using (BufferedStream bs = new BufferedStream(fs))
            {
                using (SHA1Managed sha1 = new SHA1Managed())
                {
                    byte[] hash = sha1.ComputeHash(bs);
                    StringBuilder formatted = new StringBuilder(2 * hash.Length);
                    foreach (byte b in hash)
                    {
                        formatted.AppendFormat("{0:X2}", b);
                    }

                    return formatted.ToString();
                }
            }
        }

        static void Main(string[] args)
        {
            int n = 0, l = 0, r = 0, x = 0;

            ReadInts(ref n, ref l, ref r, ref x);

            int[] c = ReadIntArrayLine();

            PrintLn(solve(n,l,r,x,c));

        }

        private static int solve(int n, int l, int r, int x, int[] c)
        {
            var selected = new List<int>();

            return solverec(n, 0 ,selected,  l,  r, x, c);
        }

        private static int solverec(int n, int v,List<int> selected, int l, int r, int x, int[] c)
        {
            if (v == n)
            {
                if (selected.Sum() >= l && selected.Sum() <= r && (selected.Max() - selected.Min()) >= x)
                    return 1;
                else
                    return 0;
            }

            int temp = solverec(n,v+1,selected,l,r,x, c);
            selected.Add(c[v]);
            temp+= solverec(n, v + 1, selected, l, r, x, c);
            selected.RemoveAt(selected.Count - 1);

            return temp;
        }
    }
}


namespace topCoder
{
	using System;
	using System.Collections.Generic;

	class p2
	{
		static void Main(string[] args)
		{
			//p1 o = new p1();
			//o.foo();

			p2 o = new p2();
			o.foo();
		}
		public void foo()
		{
			string[] sp = Console.ReadLine().Split(' ');
			int n = int.Parse(sp[0]);
			int l = int.Parse(sp[1]);
			int r = int.Parse(sp[2]);
			int x = int.Parse(sp[3]);
			int[] c = new int[n];
			sp = Console.ReadLine().Split(' ');
			for (int i = 0; i < n; i++)
			{
				c[i] = int.Parse(sp[i]);
			}
			Array.Sort(c);

			long[] s = new long[n];
			s[0] = c[0];
			for (int i = 1; i < n; i++)
			{
				s[i] = s[i - 1] + c[i];
			}

			List<KeyValuePair<int, int>> lt = new List<KeyValuePair<int,int>>();
			for (int i = 0; i < n; i++)
			{
				for (int j = i + 1; j < n; j++)
				{
					if (c[j] - c[i] >= x)
					{
						lt.Add(new KeyValuePair<int, int>(i, j));
					}
				}
			}

			int cnt = 0;
			for (int i = 0; i < lt.Count; i++)
			{
				int mi = lt[i].Key;
				int mx = lt[i].Value;
				long ss = mi - 1 >= 0 ? s[mx] - s[mi - 1] : s[mx];
				if (ss < l)
					continue;
				else
				{
					// count
					bar(c, mi+1, mx-1, l, r, new bool[mx-mi-1], 0, ref cnt);
				}
			}
			Console.WriteLine(cnt);
		}

		private void bar(int[] c, int mi, int mx, int l, int r, bool[] f, int i, ref int cnt)
		{
			if (mi+i > mx)
			{
				int sum = c[mi-1]+c[mx+1];
				for (int k = 0; k < f.Length; k++)
				{
					if (f[k])
					{
						sum += c[mi + k];
					}
				}
				if (sum >= l && sum <= r)
					cnt++;
				return;
			}
			else
			{
				f[i] = true;
				bar(c, mi, mx, l, r, f, i+1, ref cnt);
				f[i] = false;
				bar(c, mi, mx, l, r, f, i+1, ref cnt);
			}
		}
	}
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Task3
{
    class Program
    {
        static void Main(string[] args)
        {
            int productsCount;
            int minWeight;
            int maxWeight;
            int minDifference;
            List<int> weights = new List<int>();

            string[] inputString = Console.ReadLine().Split(' ');

            productsCount = Convert.ToInt32(inputString[0]);
            minWeight = Convert.ToInt32(inputString[1]);
            maxWeight = Convert.ToInt32(inputString[2]);
            minDifference = Convert.ToInt32(inputString[3]);

            string[] inputWeights = Console.ReadLine().Split(' ');

            if (inputWeights.Length != productsCount)
            {
                Console.WriteLine("count weights error!!!");
                return;
            }

            for (int i = 0; i < productsCount; i++)
            {
                weights.Add(Convert.ToInt32(inputWeights[i]));
            }

            List<List<int>> productSets = CreateProductSets(weights);

            int countVar = 0;

            foreach (List<int> subset in productSets)
            {
                int totalWeight = subset.Sum();
                int heaviestItem = subset.Max();
                int easiestItem = subset.Min();
                int difference = heaviestItem - easiestItem;

                if (totalWeight >= minWeight && totalWeight <= maxWeight)
                    if (difference >= minDifference)
                        countVar++;
            }
            Console.WriteLine(countVar);
        }

        static List<List<int>> CreateProductSets(List<int> weights)
        {
            List<List<int>> productSets = new List<List<int>>();

            for (int i = 0; i < weights.Count; i++)
            {
                int subsetCount = productSets.Count;
                productSets.Add(new List<int> { weights[i] });

                for (int j = 0; j < subsetCount; j++)
                {
                    int[] newSubset = new int[productSets[j].Count + 1];
                    productSets[j].CopyTo(newSubset, 0);
                    newSubset[newSubset.Length - 1] = weights[i];
                    productSets.Add(newSubset.ToList());
                }
            }

            return productSets;
        }
    }
}


using System;
using System.Linq;
using System.Collections.Generic;

class Program
{
    private static void Main()
    {
        int result = 0;

        var nlrx = ConsoleReadLineAsArrayOfIntegers();
        int n = nlrx[0]; int l = nlrx[1]; int r = nlrx[2]; int x = nlrx[3];

        var cc = ConsoleReadLineAsArrayOfIntegers();
        List<int> ccc = new List<int>(cc);
        ccc.Sort();

        //bool[] bits = new bool[n];

        int MAX = (int) Math.Pow(2, n);
        //Console.WriteLine("MAX = " + MAX);
        for(int i = 0; i <= MAX; i++)
        {
            if ((i & (i - 1)) == 0) continue;

            int sum = 0;
            int min = Int32.MaxValue;
            int max = Int32.MinValue;

            for(int j = 0; j < n; j++)
            {
                if ((i & (1 << j)) != 0)
                {
                    sum += ccc[j];
                    if (max > r) break;
                    if (min > ccc[j]) min = ccc[j];
                    if (max < ccc[j]) max = ccc[j];
                    //Console.Write(" " + ccc[j]);
                }
            }

            int d = max - min;

            //Console.Write("   d = " + d + "   min = " + min + "   max = " + max);

            if (l <= sum && sum <= r && d >= x)
            {
                //Console.WriteLine(" OK");
                result++;
            }
            //else
            //  Console.WriteLine(" ERROR");
        }

        Console.WriteLine("" + result);
    }

    private static int[] ConsoleReadLineAsArrayOfIntegers()
    {
        return Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
    }

    private static int ConsoleReadLineAsInteger()
    {
        return Convert.ToInt32(Console.ReadLine());
    }

    private static void ConsoleWriteLine(string line)
    {
        Console.WriteLine(line);
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace Round306
{
    class Program
    {
        #region Common Helper

        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), Encoding.ASCII, 1024 * 10);

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }

        #endregion

        #region Problem A

        private static bool ProblemAHelper(string s, string input, string reverse)
        {
            var indexAB = s.IndexOf(input, StringComparison.InvariantCulture);
            if (indexAB == -1)
                return false;
            if (indexAB == 0)
            {
                if (s.Length < 4)
                {
                    return false;
                }
                if (s.Substring(2, s.Length - 2).Contains(reverse))
                {
                    return true;
                }
            }
            else if (s.Substring(0, indexAB - 1).Contains(reverse) || s.Substring(indexAB + 2, s.Length - indexAB - 2).Contains(reverse))
            {
                return true;
            }
            return false;
        }

        private static void ProblemA()
        {
            var s = Console.ReadLine();
            if (ProblemAHelper(s, "AB", "BA") || ProblemAHelper(s, "BA", "AB"))
            {
                Console.WriteLine("YES");
                return;
            }

            Console.WriteLine("NO");
        }

        private static void TwoSubstring()
        {
            var s = Console.ReadLine();
            var subA = "AB";

            var indexA = s.IndexOf(subA, StringComparison.InvariantCulture);
            if (indexA == -1)
            {
                Console.WriteLine("NO");
                return;
            }

            var subB = "BA";
            var indexB = s.LastIndexOf(subB, StringComparison.InvariantCulture);
            if (indexB == -1)
            {
                Console.WriteLine("NO");
                return;
            }
            if (indexA + 1  < indexB)
            {
                Console.WriteLine("YES");
                return;
            }

            indexA = s.LastIndexOf(subA);
            indexB = s.IndexOf(subB);
            if (indexB + 1 < indexA)
            {
                Console.WriteLine("YES");
                return;
            }

            Console.WriteLine("NO");
        }

        private static void TwoSubstring2()
        {
            var s = Console.ReadLine();
            Console.WriteLine(s.Contains("AB") && s.Contains("BA") &&
            (s.LastIndexOf("BA", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf("AB", StringComparison.OrdinalIgnoreCase) ||
             s.LastIndexOf("AB", StringComparison.OrdinalIgnoreCase) - 1 > s.IndexOf("BA", StringComparison.OrdinalIgnoreCase))
                ? "YES": "NO");
        }

        #endregion

        #region Problem B

        private static IEnumerable<List<int>> powerSet(IList<int> input, int n = 1)
        {
            var data = input.ToArray();
            for (var i = 0; i < ((n + 1) << data.Length); i++)
            {
                var tempList = new List<int>(n + 1);
                tempList.AddRange(data.Where((t, j) => (i >> j)%2 == 1));
                yield return tempList;
            }

        }

        private static void ProblemB()
        {
            var n = Next();
            var l = Next();
            var r = Next();
            var x = Next();
            var c = new int[n];
            for (var i = 0; i < n; i++)
                c[i] = Next();

            var ans = 0;
            for (var i = 0; i < (2 << (n-1)); i++)
            {
                int i1 = i;
                var tempList = c.Where((t, j) => (i1 >> j)%2 == 1).ToList();
                if (tempList.Count > 1 && tempList.Sum() >= l && tempList.Sum() <= r && tempList.Max() - tempList.Min() >= x)
                    ans++;
            }

            Console.WriteLine(ans);
        }

        #endregion
        static void Main(string[] args)
        {
            //ProblemA();
            //TwoSubstring();
            //TwoSubstring2();

            ProblemB();
            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    void Solve()
    {
        int n = ReadInt();
        int l = ReadInt();
        int r = ReadInt();
        int x = ReadInt();
        var a = ReadIntArray();

        int ans = 0;
        for (int i = 0; i < 1 << n; i++)
        {
            int min = int.MaxValue;
            int max = int.MinValue;
            int sum = 0;
            int cnt = 0;
            for (int j = 0; j < n; j++)
                if ((i >> j & 1) == 1)
                {
                    min = Math.Min(min, a[j]);
                    max = Math.Max(max, a[j]);
                    sum += a[j];
                    cnt++;
                }
            if (max - min >= x && sum >= l && sum <= r && cnt > 1)
                ans++;
        }
        Write(ans);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("hull.in");
        //writer = new StreamWriter("hull.out");
#endif
        try
        {
            //            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //            thread.Start();
            //            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)
        {
            s += mas[i];
            if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))
            {
                ss++;
            }
            if (s < r)
            {
                for (long j = i + 1; j < n; j++)
                {
                    ss = Rec(ss, j, s, l, r, x, n, mas, k);
                }
            }
            return ss;
        }
        static void Main(string[] args)
        {
            long n, l, r, x;

            string[] lines = Console.ReadLine().Split(' ');
            n = long.Parse(lines[0]);
            l = long.Parse(lines[1]);
            r = long.Parse(lines[2]);
            x = long.Parse(lines[3]);
            long[] mas;
            mas = new long[n];
            string[] lines1 = Console.ReadLine().Split(' ');
            for (long i = 0; i < n; i++)
                mas[i] = long.Parse(lines1[i]);

            for (long i = 0; i < mas.Length; i++)
            {
                for (long j = 0; j < mas.Length - 1; j++)
                {
                    if (mas[j] > mas[j + 1])
                    {
                        long z = mas[j];
                        mas[j] = mas[j + 1];
                        mas[j + 1] = z;
                    }
                }
            }
            long s = 0, ss = 0, sl = 0;
            for (long jj = 0; jj < (n - 1); jj++)
            {
                sl = Rec(0, jj, s, l, r, x, n, mas, jj);
                ss += sl;
            }
            Console.WriteLine(ss);
            //  Console.ReadLine();
        }

    }
}


using System;
using System.Linq;

namespace CSharp
{
    public class _550B
    {
        public static void Main()
        {
            string[] tokens = Console.ReadLine().Split();

            int n = int.Parse(tokens[0]);
            int l = int.Parse(tokens[1]);
            int r = int.Parse(tokens[2]);
            int x = int.Parse(tokens[3]);

            int[] c = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int ways = 0;

            for (int i = 0; i < Math.Pow(2, n); i++)
            {
                var tasks = Enumerable.Range(0, n).Where(j => (i & (1 << j)) != 0).Select(j => c[j]).ToList();

                if (tasks.Count >= 2 && tasks.Sum() >= l && tasks.Sum() <= r && tasks.Max() - tasks.Min() >= x)
                {
                    ways++;
                }
            }

            Console.WriteLine(ways);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Threading.Tasks;

public class Test
{
    public static void Main()
    {
        string[] num = Console.ReadLine().Trim().Split();
        int n = int.Parse(num[0]);
        long mn = long.Parse(num[1]);
        long mx = long.Parse(num[2]);
        long df = long.Parse(num[3]);

        int[] a = Console.ReadLine().Trim().Split().Select(h => int.Parse(h)).ToArray();
        Console.WriteLine(ways(a, n, mn, mx, df));
    }

    public static int ways(int[] a, int n, long mn, long mx, long df)
        {
            int mask = 3, count = 0, j, i = 0;
            long minV, maxV;
            long sum;
            int end = 1 << n;
            for (; mask <= end; mask++)
            {
                minV = 1000000000; maxV = 1;
                sum = 0; i = 0;
                for (j = 0; j < n; j++)
                {
                    if ((mask & (1 << j)) != 0)
                    {
                        i++;
                        if(maxV < a[j])
                            maxV = a[j];
                        if(minV > a[j])
                            minV = a[j];
                        sum += a[j];
                    }
                }

                if ((i >= 2) && (sum >= mn) && (sum <= mx) && (maxV - minV >= df))
                    count++;

            }
            return count;
        }
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static long Rec(long ss, long i, long s, long l, long r, long x, long n, long[] mas, long k)
        {
            s += mas[i];
            if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))
            {
                ss++;
            }
            if (s < r)
            {
                for (long j = i + 1; j < n; j++)
                {
                    ss = Rec(ss, j, s, l, r, x, n, mas, k);
                }
            }
            return ss;
        }
        static void Main(string[] args)
        {
            long n, l, r, x;

            string[] lines = Console.ReadLine().Split(' ');
            n = long.Parse(lines[0]);
            l = long.Parse(lines[1]);
            r = long.Parse(lines[2]);
            x = long.Parse(lines[3]);
            long[] mas;
            mas = new long[n];
            string[] lines1 = Console.ReadLine().Split(' ');
            for (long i = 0; i < n; i++)
                mas[i] = long.Parse(lines1[i]);

            for (long i = 0; i < mas.Length; i++)
            {
                for (long j = 0; j < mas.Length - 1; j++)
                {
                    if (mas[j] > mas[j + 1])
                    {
                        long z = mas[j];
                        mas[j] = mas[j + 1];
                        mas[j + 1] = z;
                    }
                }
            }
            long s = 0, ss = 0, sl = 0;
            for (long jj = 0; jj < (n - 1); jj++)
            {
                sl = Rec(0, jj, s, l, r, x, n, mas, jj);
                ss += sl;
            }
            Console.WriteLine(ss);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Codeforces306_B
{

	class ContestIO : IDisposable
	{
		const int BufferSize = 1024 * 8;
		const string DefaultFileName = "input.txt";

		StreamReader reader;
		StreamWriter writer;

		bool TrailNewLines = false;

		public ContestIO(string fileName = null, bool trailNewLines = false)
		{
#if DEBUG
			var args = Environment.GetCommandLineArgs();
			if (args.Length > 1)
				fileName = args[1];
			else if (fileName == null)
				fileName = DefaultFileName;

			if (File.Exists(fileName))
			{
				reader = new StreamReader(File.OpenRead(fileName), Encoding.ASCII, false, BufferSize);

				var outFileName = fileName + ".out.txt";
				if (File.Exists(outFileName))
					File.Delete(outFileName);
				writer = new StreamWriter(File.OpenWrite(outFileName), Encoding.ASCII, BufferSize);
			}

			if (reader == null || writer == null)
			{
#endif
				reader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
				writer = new StreamWriter(Console.OpenStandardOutput(BufferSize), Encoding.ASCII, BufferSize);
#if DEBUG
			}
#endif
			TrailNewLines = trailNewLines;
		}

		bool IsDigit(int c)
		{
			return c >= '0' && c <= '9';
		}
		bool IsNewLine(int c)
		{
			return c == '\n' || c == '\r';
		}

		public int Read()
		{
			int c;
			while (!IsDigit(c = reader.Read())) { }

			int r = c - '0';
			while (IsDigit(c = reader.Read()))
				r = r * 10 + c - '0';

			if (TrailNewLines)
				Trail();
			return r;
		}
		public int[] ReadArray(int size)
		{
			var r = new int[size];
			for (var i = 0; i < size; i++)
				r[i] = Read();
			return r;
		}
		public string ReadLine()
		{
			return reader.ReadLine();
		}
		public void Trail()
		{
			while (IsNewLine(reader.Peek()))
				reader.Read();
		}

		public void Write(int v)
		{
			writer.Write(v);
			writer.Write(' ');
		}
		public void Write(long v)
		{
			writer.Write(v);
			writer.Write(' ');
		}
		public void Write(IEnumerable<int> arr)
		{
			foreach (var v in arr)
			{
				writer.Write(v);
				writer.Write(' ');
			}
		}
		public void WriteLine(string text = null)
		{
			if (text != null)
				writer.Write(text);
			writer.Write('\n');
		}

		public void Init<T>(T[] arr) where T : new()
		{
			for (var i = 0; i < arr.Length; i++)
				arr[i] = new T();
		}
		public void Init<T>(T[] arr, Func<T> init) where T : new()
		{
			for (var i = 0; i < arr.Length; i++)
				arr[i] = init();
		}

		public void Dispose()
		{
			writer.Flush();
		}
	}

	class Program
	{
		static void Main(string[] args)
		{
			using (var io = new ContestIO())
			{
				int n = io.Read(), l = io.Read(), r = io.Read(), x = io.Read();
				var c = io.ReadArray(n).OrderBy(ci => ci).ToArray();

				long result = 0;
				for (var i = 0; i < n; i++)
				{
					result += SolveRec(c, n, l, r, x, c[i], i + 1, c[i], c[i]);
				}
				io.Write(result);
			}
			Console.ReadLine();
		}
		static int SolveRec(int[] c, int n, int l, int r, int x, long sum, int pos, int min, int max)
		{
			var result = 0;
			if (sum <= r && sum >= l && (max - min) >= x)
				result += 1;

			if (sum > r)
				return 0;

			for (var i = pos; i < n; i++)
				result += SolveRec(c, n, l, r, x, sum + c[i], i + 1, min, c[i]);
			return result;
		}
	}
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static long Rec(long ss,long i, long s, long l,long r,long x, long n, long [] mas,long k)
        {
            s += mas[i];
            if ((s <= r) && (s >= l) && ((mas[i] - mas[k]) >= x))
            {
                ss++;
            }
            if (s < r)
            {
                for (long j = i + 1; j < n; j++)
                {
                    ss=Rec(ss,j, s,l,r,x,n,mas,k);
                }
            }
            return ss;
        }
        static void Main(string[] args)
        {
            long n,l,r,x;

            string[] lines = Console.ReadLine().Split(' ');
            n = long.Parse(lines[0]);
            l = long.Parse(lines[1]);
            r = long.Parse(lines[2]);
            x = long.Parse(lines[3]);
            long[] mas;
            mas = new long[n];
            string[] lines1 = Console.ReadLine().Split(' ');
            for (long i = 0; i < n;i++ )
                mas[i] = long.Parse(lines1[i]);

             for (long i = 0; i < mas.Length; i++)
              {
                  for (long j = 0; j < mas.Length - 1; j++)
                    {
                        if (mas[j] > mas[j + 1])
                        {
                            long z = mas[j];
                            mas[j] = mas[j + 1];
                            mas[j + 1] = z;
                        }
                    }
                }
             long s = 0,ss=0,sl=0;
             for (long jj = 0; jj < (n-1);jj++ )
             {
                 sl = Rec(0, jj, s, l, r, x, n, mas,jj);
                 ss += sl;
             }
             Console.WriteLine(ss);
           //  Console.ReadLine();
        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] info = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); //кол-во, мин.вес, макс.вес, мин.разница веса
            int[] items = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Array.Sort(items);

            List<int[]> combos = GetCombination(items);
            int NumOfWays = GetNumOfWays(combos, info[1], info[2], info[3]);
            Console.WriteLine(NumOfWays);
            Console.ReadLine();

        }
        static int GetNumOfWays(List<int[]> combos, int minP, int maxP, int minDifference)
        {
            int numOfWays = 0;
            foreach (int[] combo in combos.ToArray())
            {
                if(checkCombination(combo, minP, maxP, minDifference))
                    numOfWays++;
            }
            return numOfWays;
        }
        static bool checkCombination(int[] combo, int minP, int maxP, int minDifference)
        {
            if (combo.Length > 1)
            {
                //Array.Sort(combo);
                if ((combo[combo.Length - 1] - combo[0]) < minDifference)
                    return false;
            }

            int p = 0;
            foreach (int item in combo)
                p += item;

            if(p < minP ^ p > maxP)
                return false;
            return true;
        }
        static List<int[]> GetCombination(int[] items)
        {
            int countCombos = Convert.ToInt32(Math.Pow(2, items.Count())) - 1;
           // char[] mask;
            string mask;
            List<int[]> combos = new List<int[]>();
            List<int> temp = new List<int>();
            for (int i = 1; i <= countCombos; i++)
            {
                mask = Convert.ToString(i, 2);//.PadLeft(items.Count(), '0').ToArray();
                //for (int j = 0; j < mask.Length; j++)
                for (int j = mask.Length-1; j >=0; j--)
                {
                    if (mask[j] == '1')
                        temp.Add(items[mask.Length-j-1]);
                }
                if (temp.Count > 1)
                    combos.Add(temp.ToArray());
                temp.Clear();
            }
            return combos;
        }
    }
}


using System;

namespace Preparing_Olympiad
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            byte n = byte.Parse(input[0]);
            int l = int.Parse(input[1]),
                r = int.Parse(input[2]),
                x = int.Parse(input[3]);
            int[] c = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            int ans = 0;
            for (int m = 0; m < (1<<n); m++)
            {
                int mn = int.MaxValue, mx = int.MinValue, cnt = 0, sum = 0;
                for (int i = 0; i < n; i++)
                {
                    if((m&(1<<i)) != 0)
                    {
                        cnt++;
                        sum += c[i];
                        mn = Math.Min(mn, c[i]);
                        mx = Math.Max(mx, c[i]);
                    }
                }
                if (mx - mn >= x && sum >= l && sum <= r && cnt >= 2)
                    ans++;
            }

            Console.WriteLine(ans);

        }

    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] info = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); //кол-во, мин.вес, макс.вес, мин.разница веса
            int[] items = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            List<int[]> combos = GetCombination(items);
            int NumOfWays = GetNumOfWays(combos, info[1], info[2], info[3]);
            Console.WriteLine(NumOfWays);
            Console.ReadLine();

        }
        static int GetNumOfWays(List<int[]> combos, int minP, int maxP, int minDifference)
        {
            int numOfWays = 0;
            foreach (int[] combo in combos.ToArray())
            {
                if(checkCombination(combo, minP, maxP, minDifference))
                    numOfWays++;
            }
            return numOfWays;
        }
        static bool checkCombination(int[] combo, int minP, int maxP, int minDifference)
        {
            if (combo.Length > 1)
            {
                Array.Sort(combo);
                if ((combo[combo.Length - 1] - combo[0]) < minDifference)
                    return false;
            }

            int p = 0;
            foreach (int item in combo)
                p += item;

            if(p < minP ^ p > maxP)
                return false;
            return true;
        }
        static List<int[]> GetCombination(int[] items)
        {
            int countCombos = Convert.ToInt32(Math.Pow(2, items.Count())) - 1;
            char[] mask;
            List<int[]> combos = new List<int[]>();
            List<int> temp = new List<int>();
            for (int i = 1; i <= countCombos; i++)
            {
                mask = Convert.ToString(i, 2).PadLeft(items.Count(), '0').ToArray();
                for (int j = 0; j < mask.Length; j++)
                {
                    if (mask[j] == '1')
                        temp.Add(items[j]);
                }
                if (temp.Count > 1)
                    combos.Add(temp.ToArray());
                temp.Clear();
            }
            return combos;
        }
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
using System.Globalization;

namespace _306b
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION
            var d = readIntArray();
            var n = d[0];
            var l = d[1];
            var r = d[2];
            var x = d[3];

            var c = readIntArray();
            Array.Sort(c);

            var ts = new bool[n];
            var res = count(ts, c, n, 0, l, r, x);
            //var n = readInt();
            //var m = readInt();
            Console.WriteLine(res);
            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static int count(bool[] ts, int[] c, int n, int i, int l, int r, int x)
        {
            if (i == n)
            {
                var ct = 0;
                var md = -1;
                var sd = 0;
                var ft = -1;
                var la = -1;
                for (int j = 0; j < n; j++)
                {
                    if (ts[j])
                    {
                        sd += c[j];
                        ct++;
                        if (ft == -1)
                        {
                            ft = j;
                        }

                        la = j;
                    }
                }

                if (ct < 2)
                {
                    return 0;
                }

                if (sd < l || sd > r)
                {
                    return 0;
                }

                if (c[la] - c[ft] < x)
                {
                    return 0;
                }

                //for (int j = 0; j < n; j++)
                //{
                //    if (ts[j])
                //    {
                //        Console.Write(1);
                //    }
                //    else
                //    {
                //        Console.Write(0);
                //    }
                //}
                //Console.WriteLine();
                return 1;
            }

            var res = count(ts, c, n, i + 1, l, r, x);
            ts[i] = true;
            res += count(ts, c, n, i + 1, l, r, x);
            ts[i] = false;

            return res;
        }

        static int readInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long readLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static int N, L, R, X, cnt;
        static int[] diff;
        static string[] phrase;
        static List<int> keep = new List<int>();

        static int check()
        {
            int min = keep.Min();
            int max = keep.Max();
            int sum = keep.Sum();

            if (sum >= L && sum <= R && max - min >= X)
                return 1;

            return 0;
        }

        static void Main(string[] args)
        {
            phrase = Console.ReadLine().Split();

            N = Convert.ToInt32(phrase[0]);
            L = Convert.ToInt32(phrase[1]);
            R = Convert.ToInt32(phrase[2]);
            X = Convert.ToInt32(phrase[3]);

            phrase = Console.ReadLine().Split();
            diff = new int[phrase.Length];

            for (int i = 0; i < phrase.Length; ++i)
                diff[i] = Convert.ToInt32(phrase[i]);

            for (int i = 2; i < (1 << (N + 1) - 1); ++i)
            {
                int val = i;
                int pos = 0;
                keep.Clear();

                while (val > 0)
                {
                    if (val%2 == 1)
                        keep.Add(diff[pos]);

                     val >>= 1;
                     ++pos;
                }

                if (keep.Count >= 2)
                    cnt += check();

            }

            Console.WriteLine(cnt);;
        }
    }

}


using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace cf306
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_cf306B();
            Console.Out.Flush();
        }

        public static void solve_cf306B()
        {
            int[] nlrx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int n = nlrx[0];
            int l = nlrx[1];
            int r = nlrx[2];
            int x = nlrx[3];
            int[] c = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int cnt = 0;
            for (int i = 1; i <= (1 << n); i++)
            {
                int curSum = 0;
                int min = int.MaxValue;
                int max = 0;
                for (int j = 0; j < n; j++)
                {
                    if (Convert.ToBoolean(i & (1 << j)))
                    {
                        curSum += c[j];
                        min = Math.Min(min, c[j]);
                        max = Math.Max(max, c[j]);
                    }
                }
                if (l <= curSum && r >= curSum && max - min >= x)
                {
                    cnt++;
                }
            }
            Console.WriteLine(cnt);
        }

        public static void solve_cf306A()
        {
            string s = Console.ReadLine();
            int cnt = 0;
            for (int i = 0; i < s.Length - 1; i++)
            {
                if (s[i] == 'A' && s[i + 1] == 'B')
                {
                    if (i > 0)
                    {
                        if (s[i - 1] == 'B')
                        {
                            continue;
                        }
                    }
                    if (i < s.Length - 2)
                    {
                        if (s[i + 2] == 'A')
                        {
                            continue;
                        }
                    }
                    cnt++;
                }
                if (s[i] == 'B' && s[i + 1] == 'A')
                {
                    if (i > 0)
                    {
                        if (s[i - 1] == 'A')
                        {
                            continue;
                        }
                    }
                    if (i < s.Length - 2)
                    {
                        if (s[i + 2] == 'B')
                        {
                            continue;
                        }
                    }
                    cnt++;
                }
            }
            Console.WriteLine(cnt > 1 ? "YES" : "NO");
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace ConsoleApplication25
{
    class Program
    {
        static void Main(string[] args)
        {

            var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var n = line[0];
            var l = line[1];
            var r = line[2];
            var x = line[3];

            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int ans = 0;

            for (int i = 0; i < 1 << n; i++)
            {
                int Min = int.MaxValue;
                int Max = int.MinValue;
                int sum = 0;
                int cnt = 0;

                for (int j = 0; j < n; j++)
                {
                    if ((i >> j & 1) == 1)
                    {
                        Min = Math.Min(Min, a[j]);
                        Max = Math.Max(Max, a[j]);

                        sum += a[j];
                        cnt++;
                    }
                }
                if (Max - Min >= x && sum >= l && sum <= r && cnt > 1)
                    ans++;
            }
            Console.WriteLine(ans);
            Console.ReadLine();

        }

        static string IntToBinaryString(int bits, bool removeTrailingZero)
        {
            var sb = new StringBuilder(8);
            for (int i = 0; i < 8; i++)
            {
                if ((bits & 0x00000001) != 0)
                {
                    sb.Append("1");
                }
                else
                {
                    sb.Append("0");
                }
                bits = bits << 1;
            }
            string s = sb.ToString();
            if (removeTrailingZero)
            {
                return s.TrimStart('0');
            }
            else
            {
                return s;
            }
        }

    }
}


using System;
using System.Collections.Generic;
using System.Collections.Specialized;

namespace CodeforcesCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var ts = Console.ReadLine().Split(' ');

            var problems = int.Parse(ts[0]);
            var min = int.Parse(ts[1]);
            var max = int.Parse(ts[2]);
            var minDelta = int.Parse(ts[3]);

            var diffs = new int[problems];
            var masks = new int[problems];

            ts = Console.ReadLine().Split(' ');

            for (var i = 0; i < problems; ++i)
            {
                diffs[i] = int.Parse(ts[i]);
                masks[i] = i == 0
                    ? BitVector32.CreateMask()
                    : BitVector32.CreateMask(masks[i - 1]);
            }

            var all = 1 << problems;
            var ways = 0;
            for (var i = 1; i < all; ++i)
            {

                var bs = new BitVector32(i);
                var totDiff = 0;
                var minDiff = int.MaxValue;
                var maxDiff = int.MinValue;
                for (var j = 0; j < problems; ++j)
                    if (bs[masks[j]])
                    {
                        totDiff += diffs[j];
                        minDiff = Math.Min(minDiff, diffs[j]);
                        maxDiff = Math.Max(maxDiff, diffs[j]);
                    }
                if ((min <= totDiff) && (totDiff <= max) && (maxDiff - minDiff >= minDelta))
                {
                    //Console.WriteLine(bs);
                    ++ways;
                }
            }

            Console.WriteLine(ways);
        }
    }
}