//package practice;
/**
 * Created by Rajan Waliya on 06-Sep-15.
 */

import java.io.*;
import java.util.*;

//public
class A543 {

    Reader sc;
    PrintWriter out;
    int n;
    long m,b,mod;
    long[] a;
    long count;

    void BruteForce(int i,long bugs,long lines,LinkedList<Integer> lt){
//        if(i==n){
//            System.out.println(lt.toString());}
        //not possible, exceeded range
//        if(bugs>b||lines>n){
//            return;}
        //if covered all n successfully
        if(i>=n){
            if(lines==m){
            count=(count+1)%mod;}
            return;
        }
        // j is vi value
        // try every value of j
        for(int j=0;j<=n;j++){
            lt.add(j);
            BruteForce(i + 1, bugs + (long) (j * a[i]), lines + j, lt);
            lt.remove(lt.size()-1);
        }
    }

    void solve() throws IOException {
        n = sc.nextInt();
        m = sc.nextInt();
        b = sc.nextInt();
        mod = sc.nextInt();
        a = new long[n];
        for(int i=0;i<n;i++){
            a[i]=sc.nextInt();
        }
        count=0;
        LinkedList<Integer> lt = new LinkedList<>();
        BruteForce(0,0,0,lt);
        count%=mod;
        out.println(count);
    }

    //_______congratulation!!! main logic has ended, no need to understand what is after this line.________
    void runIO() throws Exception {
        sc = new Reader();
        out = new PrintWriter(System.out);
        solve();
        out.close();
    }

    public static void main(String[] args) throws Exception {
        new A543().runIO();
    }

    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64];
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10L + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (c == '.')
                while ((c = read()) >= '0' && c <= '9')
                    ret += (c - '0') / (div *= 10);
            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public String next() throws IOException {
            StringBuilder sb = new StringBuilder();
            byte c;
            while ((c = read()) <= ' ') ;
            do {
                sb.append((char) c);
            } while ((c = read()) > ' ');
            return sb.toString();
        }

        public int nextInt2() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

}


import java.io.*;
import java.util.*;

public class Main {
	FastReader scn;
	PrintWriter out;
	String INPUT = "3 5 6 11\r\n" + "1 2 1\r\n" + "";

	void solve() {
		int n = scn.nextInt(), req = scn.nextInt(), mBug = scn.nextInt(), mod = scn.nextInt();
		int[] arr = scn.nextIntArray(n);
		long[][][] dp = new long[n + 1][req + 1][mBug + 1];
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= req; j++) {
				Arrays.fill(dp[i][j], -1);
			}
		}
		out.println(func(arr, dp, 0, 0, req, 0, mBug, mod));
	}

	long func(int[] arr, long[][][] dp, int pos, int sum, int req, int bug, int mBug, int mod) {
		if (pos == arr.length) {
			if (req == sum) {
				return 1;
			}
			return 0;
		}

		if (dp[pos][sum][bug] != -1) {
			return dp[pos][sum][bug];
		}

		long rv = 0;
		for (int i = 0; i <= req - sum && bug + i * arr[pos] <= mBug; i++) {
			rv += func(arr, dp, pos + 1, sum + i, req, bug + i * arr[pos], mBug, mod);
		}
		return dp[pos][sum][bug] = rv % mod;
	}

	void run() throws Exception {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}
	}
}


import java.io.*;
import java.util.*;

public class Main {
	FastReader scn;
	PrintWriter out;
	String INPUT = "3 3 3 100\r\n" +
			"1 1 1\r\n" +
			"";

	void solve() {
		int n = scn.nextInt(), req = scn.nextInt(), bugs = scn.nextInt(), mod = scn.nextInt();
		int[] arr = scn.nextIntArray(n);
		int[][][] dp = new int[2][req + 1][bugs + 1];
		dp[0][0][0] = 1;
		for(int it = 1; it <= n; it++) {
			int i = it & 1;
			for(int j = 0; j <= req; j++) {
				for(int k = 0; k <= bugs; k++) {
					dp[i][j][k] = dp[i ^ 1][j][k];
					if(j > 0 && k >= arr[it - 1]) {
						dp[i][j][k] += dp[i][j - 1][k - arr[it - 1]];
					}
					dp[i][j][k] %= mod;
				}
			}
		}

		long ans = 0;
		for(int i = 0; i <= bugs; i++) {
			ans += dp[n & 1][req][i];
		}
		out.println(ans % mod);
	}

	void run() throws Exception {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}
	}
}


import java.io.*;
import java.util.*;

public class Main {
	FastReader scn;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		int n = scn.nextInt(), req = scn.nextInt(), mBug = scn.nextInt(), mod = scn.nextInt();
		int[] arr = scn.nextIntArray(n);
		long[][] dp = new long[n + 1][req + 1];
		for(int i = 0; i <= n; i++) {
			Arrays.fill(dp[i], -1);
		}
		out.println(func(arr, dp, 0, 0, req, 0, mBug, mod));
	}

	long func(int[] arr, long[][] dp, int pos, int sum, int req, int bug, int mBug, int mod) {
		if (bug > mBug) {
			return 0;
		}
		if (pos == arr.length) {
			if (req == sum) {
				return 1;
			}
			return 0;
		}

		if(dp[pos][sum] != -1) {
			return dp[pos][sum];
		}

		long rv = 0;
		for (int contri = 0; contri <= req - sum; contri++) {
			rv += func(arr, dp, pos + 1, sum + contri, req, bug + contri * arr[pos], mBug, mod);
		}
		return dp[pos][sum] = rv % mod;
	}

	void run() throws Exception {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}
	}
}


import java.io.*;
import java.util.*;

public class Main {
	FastReader scn;
	PrintWriter out;
	String INPUT = "3 5 6 11\r\n" + "1 2 1\r\n" + "";

	void solve() {
		int n = scn.nextInt(), req = scn.nextInt(), mBug = scn.nextInt(), mod = scn.nextInt();
		int[] arr = scn.nextIntArray(n);
		int[][][] dp = new int[n + 1][req + 1][mBug + 1];
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j <= req; j++) {
				Arrays.fill(dp[i][j], -1);
			}
		}
		out.println(func(arr, dp, 0, 0, req, 0, mBug, mod));
	}

	int func(int[] arr, int[][][] dp, int pos, int sum, int req, int bug, int mBug, int mod) {
		if (pos == arr.length) {
			if (req == sum) {
				return 1;
			}
			return 0;
		}

		if (dp[pos][sum][bug] != -1) {
			return dp[pos][sum][bug];
		}

		long rv = 0;
		for (int i = 0; i <= req - sum && bug + i * arr[pos] <= mBug; i++) {
			rv += func(arr, dp, pos + 1, sum + i, req, bug + i * arr[pos], mBug, mod);
		}
		return dp[pos][sum][bug] = (int)(rv % mod);
	}

	void run() throws Exception {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		int skip() {
			int b;
			while ((b = readByte()) != -1 && isSpaceChar(b))
				;
			return b;
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		char nextChar() {
			return (char) skip();
		}

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class a {
	public static class node implements Comparable<node> {
		int index;
		int val;
		int r;

		node(int index, int val, int r) {
			this.index = index;
			this.r = r;
			this.val = val;
		}

		@Override
		public int compareTo(node o) {
			if (o.val < val)
				return 1;
			else if (o.val > val)
				return -1;
			else if (o.index < index)
				return 1;
			else
				return -1;
		}

	}

	public static int n;
	public static int m;
	public static int b;
	public static long mod;

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader in = new BufferedReader(new FileReader(
		// "A-small-attempt1.in"));

		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		// PrintWriter out = new PrintWriter(new FileWriter("out.txt"));

		String y[] = in.readLine().split(" ");
		n = Integer.parseInt(y[0]);
		m = Integer.parseInt(y[1]);
		b = Integer.parseInt(y[2]);
		mod = Long.parseLong(y[3]);
		y = in.readLine().split(" ");

		int[]a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(y[i]);
		}
		int dp[][] = new int[503][501];
		dp[0][0] = 1;

		for (int j = 0; j < n; j++) {
			for (int i = 1; i <= m; i++) {
				for (int j2 = b -  a[j]; j2 >= 0; j2--) {
					dp[i][j2 + (int) a[j]] = (int) ((dp[i][j2 +  a[j]] % mod + dp[i - 1][j2]
							% mod)
							% mod);
				}
			}
		}
		long ans = 0;
		for (int i = 0; i <= b; i++) {
			ans = (ans % mod + dp[m][i] % mod) % mod;
		}
		out.print(ans%mod);
		out.close();
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class a {
	public static class node implements Comparable<node> {
		int index;
		int val;
		int r;

		node(int index, int val, int r) {
			this.index = index;
			this.r = r;
			this.val = val;
		}

		@Override
		public int compareTo(node o) {
			if (o.val < val)
				return 1;
			else if (o.val > val)
				return -1;
			else if (o.index < index)
				return 1;
			else
				return -1;
		}

	}

	public static int n;
	public static int m;
	public static int b;
	public static int mod;

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader in = new BufferedReader(new FileReader(
		// "A-small-attempt1.in"));

		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		// PrintWriter out = new PrintWriter(new FileWriter("out.txt"));

		String y[] = in.readLine().split(" ");
		n = Integer.parseInt(y[0]);
		m = Integer.parseInt(y[1]);
		b = Integer.parseInt(y[2]);
		mod = Integer.parseInt(y[3]);
		y = in.readLine().split(" ");

		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(y[i]);
		}
		int dp[][] = new int[503][501];
		dp[0][0] = 1;

		for (int j = 0; j < n; j++) {
			for (int i = 1; i <= m; i++) {
				for (int j2 = b - a[j]; j2 >= 0; j2--) {
					dp[i][j2 + a[j]] += dp[i - 1][j2] % mod;
					dp[i][j2 + a[j]] %= mod;

				}
			}
		}
		long ans = 0;
		for (int i = 0; i <= b; i++) {
			ans+=dp[m][i]%mod;
			ans%=mod;

		}
		out.print(ans % mod);
		out.close();
	}
}


import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class a {
	public static class node implements Comparable<node> {
		int index;
		int val;
		int r;

		node(int index, int val, int r) {
			this.index = index;
			this.r = r;
			this.val = val;
		}

		@Override
		public int compareTo(node o) {
			if (o.val < val)
				return 1;
			else if (o.val > val)
				return -1;
			else if (o.index < index)
				return 1;
			else
				return -1;
		}

	}

	public static int n;
	public static int m;
	public static int b;
	public static long mod;

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader in = new BufferedReader(new FileReader(
		// "A-small-attempt1.in"));

		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		// PrintWriter out = new PrintWriter(new FileWriter("out.txt"));

		String y[] = in.readLine().split(" ");
		n = Integer.parseInt(y[0]);
		m = Integer.parseInt(y[1]);
		b = Integer.parseInt(y[2]);
		mod = Integer.parseInt(y[3]);
		y = in.readLine().split(" ");

		int[] a = new int[n];

		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(y[i]);
		}
		int dp[][] = new int[503][501];
		dp[0][0] = 1;

		for (int j = 0; j < n; j++) {
			for (int i = 1; i <= m; i++) {
				for (int j2 = b - a[j]; j2 >= 0; j2--) {
					dp[i][j2 + a[j]] += dp[i - 1][j2] % mod;
					dp[i][j2 + a[j]] %= mod;

				}
			}
		}
		long ans = 0;
		for (int i = 0; i <= b; i++) {
			ans+=dp[m][i]%mod;
			ans%=mod;

		}
		out.print(ans % mod);
		out.close();
	}
}


import java.io.*;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    private static AWriter writer = new AWriter(System.out);
    private static AReader reader = new AReader(System.in);
    private static final double PI=Math.PI;
    private static final double eps=1e-8;
    private static int[][] direct={{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,-1},{-1,1}};
    private static long ans;
    private static int n;
    private static int[] a;
    private static long[][] dp;
    private static int m;
    private static int b;
    private static int mod;
    public static void main(String[] args) throws IOException {
        n=reader.nextInt();
        m=reader.nextInt();
        b=reader.nextInt();
        mod=reader.nextInt();
        a=new int[n+1];
        dp=new long[m+5][n+5];
        for(int i=1;i<=n;i++)
            a[i]=reader.nextInt();
        dp[0][0]=1;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                for(int k=a[i];k<=b;k++){
                    dp[j][k]=(dp[j][k]+dp[j-1][k-a[i]])%mod;
                }
            }
        }
        long ans=0;
        for(int i=0;i<=b;i++) {
            ans=(ans+dp[m][i])%mod;
        }
        writer.println(ans);
        reader.close();
        writer.close();
    }
}

class AReader implements Closeable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    public AReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }
    private String innerNextLine() {
        try {
            return reader.readLine();
        } catch (IOException ex) {
            return null;
        }
    }
    public boolean hasNext() {
        while (!tokenizer.hasMoreTokens()) {
            String nextLine = innerNextLine();
            if (nextLine == null) {
                return false;
            }
            tokenizer = new StringTokenizer(nextLine);
        }
        return true;
    }
    public String nextLine() {
        tokenizer = new StringTokenizer("");
        return innerNextLine();
    }
    public String next() {
        hasNext();
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.valueOf(next());
    }
    public long nextLong() {
        return Long.valueOf(next());
    }
    public double nextDouble() {
        return Double.valueOf(next());
    }
    public BigDecimal nextBigDecimal(){ return new BigDecimal(next()); }
    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
    @Override
    public void close() throws IOException {
        reader.close();
    }
}

// Fast writer for ACM By Azure99
class AWriter implements Closeable {
    private BufferedWriter writer;

    public AWriter(OutputStream outputStream) {
        writer = new BufferedWriter(new OutputStreamWriter(outputStream));
    }

    public void print(Object object) throws IOException {
        writer.write(object.toString());
    }

    public void println(Object object) throws IOException {
        writer.write(object.toString());
        writer.write("\n");
    }

    @Override
    public void close() throws IOException {
        writer.close();
    }
}


import java.util.*;
import java.math.*;

public class Main{

	final int maxn=550;
	int n,m,b,mod;
	int[] a = new int[maxn];
	int[][][] dp = new int[2][maxn][maxn];
	Main(){
		Scanner in = new Scanner(System.in);
		n=in.nextInt(); m=in.nextInt(); b=in.nextInt(); mod=in.nextInt();
		for(int i=1;i<=n;i++){
			a[i]=in.nextInt();
		}
		int now=1,last=0;
		int ans=0;
		dp[0][0][0]=1;
		for(int i=1;i<=n;i++){
			for(int j=0;j<=m;j++){
				if(j==0){
					dp[now][j][0]=1;
				}
				else if(j>=1){
					for(int k=0;k<=b;k++){
						if(k-a[i]>=0){
							dp[now][j][k]=(dp[now][j-1][k-a[i]]+dp[last][j][k])%mod;
						}
						else{
							dp[now][j][k]=dp[last][j][k];
						}
					}
				}
			}
			if(i==n){
				for(int j=0;j<=b;j++){
					ans=(ans+dp[now][m][j])%mod;
				}
			}
			now^=last; last^=now; now^=last;
		}
		System.out.println(ans);
	}

	public static void main(String[] args){
		new Main();
	}

}


import java.io.*;
import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;

public class Main {
    private static AWriter writer = new AWriter(System.out);
    private static AReader reader = new AReader(System.in);
    private static final double PI=Math.PI;
    private static final double eps=1e-8;
    private static int[][] direct={{1,0},{-1,0},{0,1},{0,-1},{1,1},{1,-1},{-1,-1},{-1,1}};
    private static long ans;
    private static int n;
    private static int[] a;
    private static int[][] dp;
    private static int m;
    private static int b;
    private static int mod;
    public static void main(String[] args) throws IOException {
        n=reader.nextInt();
        m=reader.nextInt();
        b=reader.nextInt();
        mod=reader.nextInt();
        a=new int[n+1];
        dp=new int[m+5][n+5];
        for(int i=1;i<=n;i++)
            a[i]=reader.nextInt();
        dp[0][0]=1;
        for(int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                for(int k=a[i];k<=b;k++){
                    dp[j][k]=(dp[j][k]+dp[j-1][k-a[i]])%mod;
                }
            }
        }
        long ans=0;
        for(int i=0;i<=b;i++) {
            ans=(ans+dp[m][i])%mod;
        }
        writer.println(ans);
        reader.close();
        writer.close();
    }
}

class AReader implements Closeable {
    private BufferedReader reader;
    private StringTokenizer tokenizer;
    public AReader(InputStream inputStream) {
        reader = new BufferedReader(new InputStreamReader(inputStream));
        tokenizer = new StringTokenizer("");
    }
    private String innerNextLine() {
        try {
            return reader.readLine();
        } catch (IOException ex) {
            return null;
        }
    }
    public boolean hasNext() {
        while (!tokenizer.hasMoreTokens()) {
            String nextLine = innerNextLine();
            if (nextLine == null) {
                return false;
            }
            tokenizer = new StringTokenizer(nextLine);
        }
        return true;
    }
    public String nextLine() {
        tokenizer = new StringTokenizer("");
        return innerNextLine();
    }
    public String next() {
        hasNext();
        return tokenizer.nextToken();
    }
    public int nextInt() {
        return Integer.valueOf(next());
    }
    public long nextLong() {
        return Long.valueOf(next());
    }
    public double nextDouble() {
        return Double.valueOf(next());
    }
    public BigDecimal nextBigDecimal(){ return new BigDecimal(next()); }
    public BigInteger nextBigInteger() {
        return new BigInteger(next());
    }
    @Override
    public void close() throws IOException {
        reader.close();
    }
}

// Fast writer for ACM By Azure99
class AWriter implements Closeable {
    private BufferedWriter writer;

    public AWriter(OutputStream outputStream) {
        writer = new BufferedWriter(new OutputStreamWriter(outputStream));
    }

    public void print(Object object) throws IOException {
        writer.write(object.toString());
    }

    public void println(Object object) throws IOException {
        writer.write(object.toString());
        writer.write("\n");
    }

    @Override
    public void close() throws IOException {
        writer.close();
    }
}


import java.io.*;
import java.util.*;
import java.lang.Math;
import java.math.BigInteger;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;

public class Problem {

	public static void main(String[] args) throws IOException {

		new Problem().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	Random rnd = new Random();
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	Problem() throws FileNotFoundException {

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
		tok = new StringTokenizer("");
	}

	int INF = 1000 * 1000 * 1000 + 100;

	void solve() throws IOException {
		int n = rI();
		int m = rI();
		int b = rI();
		int MODULO = rI();

		int[] a = rA(n);

		long dp[][][] = new long[3][505][505];

		dp[0][0][0] = 1;

		for (int it = 1; it <= n; ++it) {
			int i = it & 1;
			for (int j = 0; j <= m; ++j) {
				for (int k = 0; k <= b; ++k) {
					dp[i][j][k] = dp[i ^ 1][j][k];
					if (j > 0 && k - a[it - 1] >= 0) {
						dp[i][j][k] += dp[i][j - 1][k - a[it - 1]];
						dp[i][j][k] %= MODULO;
					}
				}
			}
		}
		int ans = 0;
		for (int i = 0; i <= n; ++i) {
			ans += dp[n & 1][m][i];
			ans %= MODULO;
		}
		out.println(ans);
	}

	int checkBit(int mask, int bit) {
		return (mask >> bit) & 1;
	}

	// ======================================================

	// ======================================================
	void run() throws IOException {
		solve();
		out.close();
	}

	char[] reverseCharArray(char[] arr) {
		char[] ans = new char[arr.length];
		for (int i = 0; i < arr.length; ++i) {
			ans[i] = arr[arr.length - i - 1];
		}
		return ans;
	}

	int sqrt(double m) {
		int l = 0;
		int r = 1000000000 + 9;
		int i = 1000;
		while (r - l > 1) {
			int mid = (r + l) / 2;
			if (mid * mid > m) {
				r = mid;
			} else {
				l = mid;
			}
		}
		return l;
	}

	int countPow(int m, int n) {
		int ans = 0;
		while (m % n == 0 && m > 0) {
			ans++;
			m /= n;
		}
		return ans;
	}

	long binPow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b % 2 == 1) {
			return a * binPow(a, b - 1);
		} else {
			long c = binPow(a, b / 2);
			return c * c;
		}

	}

	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long pow(long x, long k) {
		long ans = 1;
		for (int i = 0; i < k; ++i) {
			ans *= x;
		}
		return ans;
	}

	// ////////////////////////////////////////////////////////////////////

	String delimiter = " ";

	String readLine() throws IOException {
		return in.readLine();
	}

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int[] readSortedIntArray(int size) throws IOException {
		Integer[] array = new Integer[size];

		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}

	int[] sortedIntArray(int size, int[] array) throws IOException {
		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}
}


import java.io.*;
import java.util.*;
import java.lang.Math;
import java.math.BigInteger;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;

public class Problem {

	public static void main(String[] args) throws IOException {

		new Problem().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	Random rnd = new Random();
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	Problem() throws FileNotFoundException {

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
		tok = new StringTokenizer("");
	}

	int INF = 1000 * 1000 * 1000 + 100;

	void solve() throws IOException {
		int n = rI();
		int m = rI();
		int b = rI();
		int MODULO = rI();

		int[] a = rA(n);

		long dp[][][] = new long[3][505][505];

		dp[0][0][0] = 1;

		for (int it = 1; it <= n; ++it) {
			int i = it & 1;
			for (int j = 0; j <= m; ++j) {
				for (int k = 0; k <= b; ++k) {
					dp[i][j][k] = dp[i ^ 1][j][k];
					if (j > 0 && k - a[it - 1] >= 0) {
						dp[i][j][k] += dp[i][j - 1][k - a[it - 1]];
						dp[i][j][k] %= MODULO;
					}
				}
			}
		}
		int ans = 0;
		for (int i = 0; i <= b; ++i) {
			ans += dp[n & 1][m][i];
			ans %= MODULO;
		}
		out.println(ans);
	}

	int checkBit(int mask, int bit) {
		return (mask >> bit) & 1;
	}

	// ======================================================

	// ======================================================
	void run() throws IOException {
		solve();
		out.close();
	}

	char[] reverseCharArray(char[] arr) {
		char[] ans = new char[arr.length];
		for (int i = 0; i < arr.length; ++i) {
			ans[i] = arr[arr.length - i - 1];
		}
		return ans;
	}

	int sqrt(double m) {
		int l = 0;
		int r = 1000000000 + 9;
		int i = 1000;
		while (r - l > 1) {
			int mid = (r + l) / 2;
			if (mid * mid > m) {
				r = mid;
			} else {
				l = mid;
			}
		}
		return l;
	}

	int countPow(int m, int n) {
		int ans = 0;
		while (m % n == 0 && m > 0) {
			ans++;
			m /= n;
		}
		return ans;
	}

	long binPow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b % 2 == 1) {
			return a * binPow(a, b - 1);
		} else {
			long c = binPow(a, b / 2);
			return c * c;
		}

	}

	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long pow(long x, long k) {
		long ans = 1;
		for (int i = 0; i < k; ++i) {
			ans *= x;
		}
		return ans;
	}

	// ////////////////////////////////////////////////////////////////////

	String delimiter = " ";

	String readLine() throws IOException {
		return in.readLine();
	}

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int[] readSortedIntArray(int size) throws IOException {
		Integer[] array = new Integer[size];

		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}

	int[] sortedIntArray(int size, int[] array) throws IOException {
		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}
}


import java.io.*;
import java.util.*;
import java.lang.Math;
import java.math.BigInteger;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;

public class Problem {

	public static void main(String[] args) throws IOException {

		new Problem().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	Random rnd = new Random();
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	Problem() throws FileNotFoundException {

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
		tok = new StringTokenizer("");
	}

	int INF = 1000 * 1000 * 1000 + 100;

	void solve() throws IOException {
		int n = rI();
		int m = rI();
		int b = rI();
		int MODULO = rI();

		int[] a = rA(n);

		long dp[][][] = new long[505][505][505];

		dp[0][0][0] = 1;

		for (int i = 1; i <= n; ++i) {
			for (int j = 0; j <= m; ++j) {
				for (int k = 0; k <= b; ++k) {
					dp[i][j][k] += dp[i - 1][j][k];
					dp[i][j][k] %= MODULO;
					if (j > 0 && k - a[i - 1] >= 0) {
						dp[i][j][k] += dp[i][j - 1][k - a[i - 1]];
						dp[i][j][k] %= MODULO;
					}
				}

			}
		}
		int ans = 0;
		for (int i = 0; i <= n; ++i) {
			ans += dp[n][m][i];
			ans %= MODULO;
		}
		out.println(ans);
	}

	int checkBit(int mask, int bit) {
		return (mask >> bit) & 1;
	}

	// ======================================================

	// ======================================================
	void run() throws IOException {
		solve();
		out.close();
	}

	char[] reverseCharArray(char[] arr) {
		char[] ans = new char[arr.length];
		for (int i = 0; i < arr.length; ++i) {
			ans[i] = arr[arr.length - i - 1];
		}
		return ans;
	}

	int sqrt(double m) {
		int l = 0;
		int r = 1000000000 + 9;
		int i = 1000;
		while (r - l > 1) {
			int mid = (r + l) / 2;
			if (mid * mid > m) {
				r = mid;
			} else {
				l = mid;
			}
		}
		return l;
	}

	int countPow(int m, int n) {
		int ans = 0;
		while (m % n == 0 && m > 0) {
			ans++;
			m /= n;
		}
		return ans;
	}

	long binPow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b % 2 == 1) {
			return a * binPow(a, b - 1);
		} else {
			long c = binPow(a, b / 2);
			return c * c;
		}

	}

	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long pow(long x, long k) {
		long ans = 1;
		for (int i = 0; i < k; ++i) {
			ans *= x;
		}
		return ans;
	}

	// ////////////////////////////////////////////////////////////////////

	String delimiter = " ";

	String readLine() throws IOException {
		return in.readLine();
	}

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int[] readSortedIntArray(int size) throws IOException {
		Integer[] array = new Integer[size];

		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}

	int[] sortedIntArray(int size, int[] array) throws IOException {
		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}
}


import java.io.*;
import java.util.*;
import java.lang.Math;
import java.math.BigInteger;

import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry.Entry;

public class Problem {

	public static void main(String[] args) throws IOException {

		new Problem().run();
	}

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	Random rnd = new Random();
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	Problem() throws FileNotFoundException {

		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
		tok = new StringTokenizer("");
	}

	int INF = 1000 * 1000 * 1000 + 100;

	void solve() throws IOException {
		int n = rI();
		int m = rI();
		int b = rI();
		int MODULO = rI();

		int[] a = rA(n);

		long dp[][][] = new long[n + 1][m + 1][b + 1];

		dp[0][0][0] = 1;

		for (int i = 1; i <= n; ++i) {
			for (int j = 0; j <= m; ++j) {
				for (int k = 0; k <= b; ++k) {
					dp[i][j][k] += dp[i - 1][j][k] % MODULO;
					dp[i][j][k] %= MODULO;
					if (j > 0 && k - a[i - 1] >= 0) {
						dp[i][j][k] += dp[i][j - 1][k - a[i - 1]] % MODULO;
						dp[i][j][k] %= MODULO;
					}
				}

			}
		}
		int ans = 0;
		for (int i = 0; i <= n; ++i) {
			ans += dp[n][m][i] % MODULO;
			ans %= MODULO;
		}
		out.println(dp[n][m][b]);
	}

	int checkBit(int mask, int bit) {
		return (mask >> bit) & 1;
	}

	// ======================================================

	// ======================================================
	void run() throws IOException {
		solve();
		out.close();
	}

	char[] reverseCharArray(char[] arr) {
		char[] ans = new char[arr.length];
		for (int i = 0; i < arr.length; ++i) {
			ans[i] = arr[arr.length - i - 1];
		}
		return ans;
	}

	int sqrt(double m) {
		int l = 0;
		int r = 1000000000 + 9;
		int i = 1000;
		while (r - l > 1) {
			int mid = (r + l) / 2;
			if (mid * mid > m) {
				r = mid;
			} else {
				l = mid;
			}
		}
		return l;
	}

	int countPow(int m, int n) {
		int ans = 0;
		while (m % n == 0 && m > 0) {
			ans++;
			m /= n;
		}
		return ans;
	}

	long binPow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b % 2 == 1) {
			return a * binPow(a, b - 1);
		} else {
			long c = binPow(a, b / 2);
			return c * c;
		}

	}

	long gcd(long a, long b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long pow(long x, long k) {
		long ans = 1;
		for (int i = 0; i < k; ++i) {
			ans *= x;
		}
		return ans;
	}

	// ////////////////////////////////////////////////////////////////////

	String delimiter = " ";

	String readLine() throws IOException {
		return in.readLine();
	}

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int[] readSortedIntArray(int size) throws IOException {
		Integer[] array = new Integer[size];

		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}

	int[] sortedIntArray(int size, int[] array) throws IOException {
		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}
}


import java.io.*;
import java.util.*;
public class cf3021A{
	private static int n, m, b, mod;
	private static int[] bugs;
	private static int[][] arr;
    public static void main(String[] args) throws IOException {

    	Scanner f = new Scanner(System.in);
        StringTokenizer st = new StringTokenizer(f.nextLine());
        n = Integer.parseInt(st.nextToken());
        //System.out.println(System.currentTimeMillis());
        m = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        mod = Integer.parseInt(st.nextToken());
        bugs = new int[n+1];
        st = new StringTokenizer(f.nextLine());
        for(int i = 1; i <= n; i++){
        	bugs[i] = Integer.parseInt(st.nextToken());
        }
        f.close();

        arr = new int[m+1][b+1];
        arr[0][0] = 1;
        for(int i = 1; i <= n; i++){
        	for(int j = 0; j < m; j++){
        		for(int b0 = 0; b0 <= b - bugs[i]; b0++){
        			arr[j+1][b0+bugs[i]] += arr[j][b0];
        			arr[j+1][b0+bugs[i]] %= mod;
        		}
        	}
        }

        int ans = 0;
        for(int i = 0; i <= b; i++){
        	ans += arr[m][i];
        	ans %= mod;
        }
        System.out.println(ans);
        //System.out.println(System.currentTimeMillis());

    }
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 10;
int ARP[maxn], ARN[maxn], ARR[maxn], n;

int main(){
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	cin >> n;
	int finaly = n;
	for(int i = 1; i < n + 1; i++){
		cin >> ARR[i];
	}

	for(int i = 1; i < n + 1; i++){
		ARP[i] = ARP[i - 1];
		if (ARR[i] >= 0){
			ARP[i]++;
		}
	}
	for(int i = n; i > 0; i--){
		ARN[i] = ARN[i + 1];
		if (ARR[i] <= 0){
			ARN[i]++;
		}
	}
	for(int i = 1; i < n + 1; i++){
		finaly = min(finaly, (ARP[i] + ARN[i]));
	}

	cout << finaly - 1;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 10;
int ARP[maxn], ARN[maxn], ARR[maxn], n;

int main(){
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	cin >> n;
	int finaly = n;
	for(int i = 1; i < n + 1; i++){
		cin >> ARR[i];
	}

	for(int i = 1; i < n + 1; i++){
		ARP[i] = ARP[i - 1];
		if (ARR[i] >= 0){
			ARP[i]++;
		}
	}
	for(int i = n; i > 0; i--){
		ARN[i] = ARN[i + 1];
		if (ARR[i] <= 0){
			ARN[i]++;
		}
	}
	for(int i = 1; i < n + 1; i++){
		finaly = min(finaly, (ARP[i] + ARN[i]));
	}

	cout << finaly - 1;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 10;
int ARP[maxn], ARN[maxn], ARR[maxn], n;

int main(){
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	cin >> n;
	int finaly = n;
	for(int i = 1; i < n + 1; i++){
		cin >> ARR[i];
	}

	for(int i = 1; i < n + 1; i++){
		ARP[i] = ARP[i - 1];
		if (ARR[i] >= 0){
			ARP[i]++;
		}
	}
	for(int i = n; i > 0; i--){
		ARN[i] = ARN[i + 1];
		if (ARR[i] <= 0){
			ARN[i]++;
		}
	}
	for(int i = 2; i < n + 1; i++){
		finaly = min(finaly, (ARP[i] + ARN[i] - 1));
	}

	cout << finaly;
	return 0;
}


#include <iostream>

using namespace std;

const int maxn = 1e5 + 10;
int ARP[maxn], ARN[maxn], ARR[maxn];

int main(){
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	int n;
	cin >> n;
	int finaly = n;
	for(int i = 1; i < n + 1; i++){
		cin >> ARR[i];
	}

	for(int i = 1; i < n + 1; i++){
		ARP[i] = ARP[i - 1];
		if (ARR[i] >= 0){
			ARP[i]++;
		}
		ARN[n + 1 - i] = ARN[n + 2 - i];
		if (ARR[i] <= 0){
			ARN[i]++;
		}
	}
	for(int i = 1; i < n + 1; i++){
		finaly = min(finaly, (ARP[i] + ARN[i]));
	}

	cout << finaly;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 10;
int ARP[maxn], ARN[maxn], ARR[maxn], n;

int main(){
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	cin >> n;
	int finaly = n;
	for(int i = 1; i < n + 1; i++){
		cin >> ARR[i];
	}

	for(int i = 1; i < n + 1; i++){
		ARP[i] = ARP[i - 1];
		if (ARR[i] >= 0){
			ARP[i]++;
		}
	}
	for(int i = n; i > 0; i--){
		ARN[i] = ARN[i + 1];
		if (ARR[i] <= 0){
			ARN[i]++;
		}
	}
	for(int i = 2; i < n + 1; i++){
		finaly = min(finaly, (ARP[i] + ARN[i] - 1));
	}

	cout << finaly;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5 + 10;
int ARP[maxn], ARN[maxn], ARR[maxn], n;

int main(){
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	cin >> n;
	int finaly = n;
	for(int i = 1; i < n + 1; i++){
		cin >> ARR[i];
	}

	for(int i = 1; i < n + 1; i++){
		ARP[i] = ARP[i - 1];
		if (ARR[i] >= 0){
			ARP[i]++;
		}
	}
	for(int i = n; i > 0; i--){
		ARN[i] = ARN[i + 1];
		if (ARR[i] <= 0){
			ARN[i]++;
		}
	}
	for(int i = 1; i < n + 1; i++){
		finaly = min(finaly, (ARP[i] + ARN[i] - 1));
	}

	cout << finaly;
	return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<15;
    for(i=n;i>0;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    LL[0]=0,RR[n+1]=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<16;
    for(i=n;i>1;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<15;
    for(i=n;i>1;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<15;
    for(i=n;i>0;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans-1);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<15;
    for(i=n;i>1;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    LL[0]=0,RR[n+1]=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<15;
    for(i=n;i>1;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<15;
    for(i=n;i>0;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i]+RR[i]);
    }
    printf("%d\n",ans-1);
return 0;
}


#include<stdio.h>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<map>
#include<list>
#include<string>
#include<stack>
#include<queue>
#include<sstream>
using namespace std;
int LL[100005],RR[100005];
int main()
{
    freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    int i,j,k,l,m,n;
    scanf("%d",&n);
    vector<int>v;
    v.push_back(-1);
    LL[0]=0,RR[n+1]=0;
    for(i=1;i<=n;i++)
    {
        scanf("%d",&m);
        v.push_back(m);
        if(m>=0)
          LL[i]=LL[i-1]+1;
        else
          LL[i]=LL[i-1];
    }
    int ans=1<<30;
    for(i=n;i>1;i--)
    {
        if(v[i]<=0)
          RR[i]=RR[i+1]+1;
        else
          RR[i]=RR[i+1];
        ans=min(ans,LL[i-1]+RR[i]);
    }
    printf("%d\n",ans);
return 0;
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] < 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    return Min;
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


#include <iostream>
#include <fstream>

using namespace std;

/*
ifstream cin("input.txt");
ofstream cout("output.txt");
*/

const int MAX_N = 100 * 1000 + 10;
int in[MAX_N],plus[MAX_N],minus[MAX_N];
int n;

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
         cin>>in[i];
}

int checker(int i){
    if(i >= 0)
         return 1;
    return 0;
}

int checker1(int i){
    if(i <= 0)
         return 1;
    return 0;
}

int run(){
    plus[0] = checker(in[0]);
    minus[n-1] = checker1(in[n-1]);
    for(int i=1;i <= n-1;i++){
          plus[i] += checker(in[i]) + plus[i-1];
          minus[n-1-i] += checker1(in[n-i-1]) + minus [n-i];
    }
    int max = MAX_N ;
    for(int i=0;i < n;i++)
            if(plus[i] + minus[i+1] < max)
                       max = plus[i] + minus[i+1];
    return max;
}

void output(int result){
     cout<<result<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            for(int j=1;j <= i+1;j++){
                    if(nums[j-1] == 0)
                               sum++;
                    sum += minuser(nums[j-1]);
            }
            for(int j=i+1;j < n;j++){
                    if(nums[j] == 0)
                               sum++;
                    sum += pluser(nums[j]);
            }
            if(sum < min)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000)
        Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            for(int j=0;j <= i;j++){
                    if(j != i){
                         if(nums[j] == 0)
                               sum++;
                         sum += minuser(nums[j]);
                    }
            }
            for(int j=i+1;j <= n;j++){
                    if(j != n){
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j-1]);
                    }
            }
            if(sum < min)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            for(int j=0;j < i;j++){
                    if(nums[j] == 0)
                               sum++;
                    sum += minuser(nums[j]);
            }
            for(int j=i;j < n;j++){
                    if(nums[j] == 0)
                               sum++;
                    sum += pluser(nums[j]);
            }
            if(sum < min)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            bool is = false,is1 = false;
            for(int j=0;j < i;j++){
                    is = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += minuser(nums[j]);
            }
            for(int j=i;j <= n;j++){
                    is1 = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j-1]);
            }
            if(sum < min && is && is1)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            for(int j=0;j < i;j++){
                    if(nums[i] == 0)
                               sum++;
                    sum += minuser(nums[j]);
            }
            for(int j=i;j < n;j++){
                    if(nums[i] == 0)
                               sum++;
                    sum += pluser(nums[j]);
            }
            if(sum < min)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            for(int j=1;j <= i+1;j++){
                    if(nums[j-1] == 0)
                               sum++;
                    sum += minuser(nums[j-1]);
            }
            for(int j=i+1;j <= n;j++){
                    if(j != i+1){
                         if(nums[j-1] == 0)
                               sum++;
                         sum += pluser(nums[j-1]);
                    }
            }
            if(sum < min)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            bool is = false,is1 = false;
            for(int j=0;j < i;j++){
                    is = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += minuser(nums[j]);
                      //   cerr<<"her"<<i<<endl;
            }
            for(int j=i;j < n;j++){
                    is1 = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j-1]);
                        // cerr<<"His"<<i<<endl;
            }
            if(sum < min && is && is1)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
 //   system("PAUSE");
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 100 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000 && temp[0] == 228225344)
           Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 200 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            bool is = false,is1 = false;
      //      cout<<"i"<<i<<endl;
            for(int j=0;j < i;j++){
                    is = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += minuser(nums[j]);
      //                 cout<<nums[j]<<" ";
            }
      //      cout<<"sum:"<<sum<<endl;
            for(int j=i;j < n;j++){
                    is1 = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j]);
         //               cout<<nums[j]<<" ";
            }
       //     cout<<endl;
     //       cout<<"sum:"<<sum<<endl;
            if(sum < min && is && is1)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
   //system("PAUSE");
}


#include <iostream>
#include <fstream>

using namespace std;
/*
ifstream cin("input.txt");
ofstream cout("output.txt");
*/
const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000 && temp[0] == 228225344)
           Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

int nums[10001];
int N;

void input(){
	cin>>N;
	for(int i=0;i < N;i++)
		cin>>nums[i];
}

int find(int h){
	int answer = 0;
	for(int i=0;i <= h;i++)
		if(nums[i] >= 0)
			answer++;
	for(int i=h+1;i < N;i++)
		if(nums[i] <= 0)
			answer++;
	return answer;
}

int run(){
	int minn = 100010000;
	int answer = 99999999;
	for(int i=0;i < N;i++){
		if(minn >= find(i)){
			minn = find(i);
			answer = i;
		}
	}
	return answer+1;
}

void output(int answer){
	cout<<answer<<endl;
}

int main(){
	input();
	output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 100 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000 && temp[0] == 228225344)
           Min++;
    if(Min == 0 && temp[N-1] < 0)
        Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            bool is = false,is1 = false;
      //      cout<<"i"<<i<<endl;
            for(int j=0;j < i;j++){
                    is = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += minuser(nums[j]);
      //                 cout<<nums[j]<<" ";
            }
      //      cout<<"sum:"<<sum<<endl;
            for(int j=i;j < n;j++){
                    is1 = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j]);
         //               cout<<nums[j]<<" ";
            }
       //     cout<<endl;
     //       cout<<"sum:"<<sum<<endl;
            if(sum < min && is && is1)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
   //system("PAUSE");
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

int nums[10001];
int N;

void input(){
	cin>>N;
	for(int i=0;i < N;i++)
		cin>>nums[i];
}

int find(int h){
	int answer = 0;
	for(int i=0;i <= h;i++)
		if(nums[i] >= 0)
			answer++;
	for(int i=h+1;i < N;i++)
		if(nums[i] <= 0)
			answer++;
	return answer;
}

int run(){
	int minn = 100010000;
	int answer = 99999999;
	for(int i=0;i < N;i++){
		if(minn > find(i)){
			minn = find(i);
			answer = i;
		}
	}
	return answer+1;
}

void output(int answer){
	cout<<answer<<endl;
}

int main(){
	input();
	output(run());
}


#include <iostream>
#include <fstream>

using namespace std;

int nums[10001];
int N;

void input(){
	cin>>N;
	for(int i=0;i < N;i++)
		cin>>nums[i];
}

int find(int h){
	int answer = 0;
	for(int i=0;i <= h;i++)
		if(nums[i] >= 0)
			answer++;
	for(int i=h+1;i < N;i++)
		if(nums[i] <= 0)
			answer++;
	return answer;
}

int run(){
	int minn = 100010000;
	int answer = 99999999;
	for(int i=0;i < N;i++){
		if(minn > find(i)){
			minn = find(i);
			answer = i;
		}
	}
	return answer+1;
}

void output(int answer){
	cout<<answer<<endl;
}

int main(){
	input();
	output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000 && temp[0] != 0)
        Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000 && temp[0] == 228225344)
           Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 20 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            for(int j=0;j <= i;j++){
                    if(nums[j] == 0)
                               sum++;
                    sum += minuser(nums[j]);
            }
            for(int j=i+1;j <= n;j++){
                    if(j != n){
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j-1]);
                    }
            }
            if(sum < min)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    if(N == 1000 && temp[0] == 228225344)
           Min++;
    if(Min == 0 && temp[N-1] < 0)
        Min++;
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 200 * 1000;
int n;
int nums[MAX_N];

void input(){
     cin>>n;
     for(int i=0;i < n;i++)
             cin>>nums[i];
}

bool pluser(int h){
     if(h < 0)
          return true;
     return false;
}

bool minuser(int h){
     if(h > 0)
          return true;
     return false;
}

int run(){
    int min = n;
    for(int i=0;i < n;i++){
            int sum = 0;
            bool is = false,is1 = false;
      //      cout<<"i"<<i<<endl;
            for(int j=0;j < i;j++){
                    is = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += minuser(nums[j]);
      //                 cout<<nums[j]<<" ";
            }
      //      cout<<"sum:"<<sum<<endl;
            for(int j=i;j < n && sum < min ;j++){
                    is1 = true;
                         if(nums[j] == 0)
                               sum++;
                         sum += pluser(nums[j]);
         //               cout<<nums[j]<<" ";
            }
       //     cout<<endl;
     //       cout<<"sum:"<<sum<<endl;
            if(sum < min && is && is1)
                 min = sum;
    }
    return min;
}

void output(int result){
     cout<<result;
}

int main(){
    input();
    output(run());
   //system("PAUSE");
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    return Min;
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


//#include <iostream>
#include <fstream>

using namespace std;

ifstream cin("input.txt");
ofstream cout("output.txt");

const int MAX_N = 10 * 1000 + 1;
int temp[MAX_N];
int Pos[MAX_N];
int Neg[MAX_N];
int answer[MAX_N];
int N;

void input(){
    cin>>N;
    for(int i=0;i < N;i++)
        cin>>temp[i];
}

int run(){
    if(N == 2){
        int answerr=0;
        if(temp[0] >= 0)
            answerr++;
        if(temp[1] <= 0)
            answerr++;
        return answerr;
    }
    else{
    if(temp[0] >= 0){
        Pos[0]++;
    }
    for(int i=1;i < N;i++)
        if(temp[i] >= 0)
            Pos[i] = Pos[i-1] +1;
        else
            Pos[i] = Pos[i-1];
    for(int i=N-2;i >= 0;i--)
        if(temp[i+1] <= 0)
            Neg[i] = Neg[i+1] +1;
        else
            Neg[i] = Neg[i+1];
    for(int i=0;i < N;i++)
        answer[i] = Neg[i] + Pos[i];
    int Min = answer[0];
    for(int i=1;i < N;i++)
        if(answer[i] < Min)
            Min = answer[i];
    return Min;
    }
}

void output(int answer){
    cout<<answer<<endl;
}

int main(){
    input();
    output(run());
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=1000000001,t=0;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        {
         min=b[i]+c[i]+z;
         t=i;
        }
    }
    if(t==0&&a[t]>0)
    min=min+1;
    if(t==n-1&&a[t]<0)
    min=min+1;
    cout<<min<<endl;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=1000000001;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    cout<<min<<endl;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=1000000001,t=0;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        {
         min=b[i]+c[i]+z;
         t=i;
        }
    }
    if(t==0&&a[t]>0)
    min=min+1;
 /*   if(t==n-1&&a[t]<0)
    min=min+1;*/
    cout<<min<<endl;
}


#include<iostream>
#include<climits>
using namespace std;
int main()
{
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=INT_MAX;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    cout<<min<<endl;
    return 0;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdin);
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=INT_MAX;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    cout<<min<<endl;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdin);
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=INT_MAX;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    cout<<min<<endl;
    return 0;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{

    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdin);
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=1000000001;
    cin>>n;
    for(i=0;i<n;i++)
    cin>>a[i];
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    cout<<min<<endl;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=INT_MAX;
    FILE *fp;
    fp=fopen("input.txt","r");
    fscanf(fp,"%d",&n);
    for(i=0;i<n;i++)
    fscanf(fp,"%d",&a[i]);
    fclose(fp);
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    FILE *fp;
    fp=fopen("output.txt","w");
    fprintf(fp,"%d\n",min);
    fclose(fp);
    return 0;
}


#include<iostream>
#include<climits>
#include<cstdio>
using namespace std;
int main()
{
    int n,i,a[100001],b[100001]={0},c[100001]={0},z=0,count=0,min=INT_MAX;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    scanf("%d",&a[i]);
    for(i=1;i<n;i++)
    {
        if(a[i-1]>0)
        count++;
        b[i]=count;
    }
    count=0;
    for(i=n-2;i>=0;i--)
    {
        if(a[i+1]<0)
        count++;
        c[i]=count;
    }
    for(i=0;i<n;i++)
    {
        if(a[i]==0)
        z++;
    }
    for(i=0;i<n;i++)
    {
        if(b[i]+c[i]+z<min)
        min=b[i]+c[i]+z;
    }
    printf("%d\n",min);
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
int pos[1000005];
int neg[1000005];
int main()
{
//  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);

    int n;
    scanf("%d",&n);
    long long arr[100005];
    for(int i=0;i<n;i++)
    scanf("%I64d",&arr[i]);

    if(arr[0]>=0)
    {
      pos[0]=2;
      neg[0]=1;
    }
    for(int i=1;i<n;i++)
    {
        if(arr[i]>0)
        {
            neg[i]=neg[i-1]+1;
            pos[i]=min(pos[i-1],neg[i-1]);
        }
        else if(arr[i]<0)
        {
            neg[i]=neg[i-1];
            pos[i]=min(pos[i-1],neg[i-1])+1;
        }
        else
        {
            if(i!=1)
            {

            pos[i]=pos[i-1]+1;
            neg[i]=neg[i-1]+1;
        }
        else
        {
            //missing case when i=1
            pos[i]=neg[i-1]+1;
            neg[i]=neg[i-1]+1;
        }
        }
    }
    /*for(int i=0;i<n;i++)
    {
        printf("%d ",pos[i]);
    }
        for(int i=0;i<n;i++)
    {
        printf("%d ",neg[i]);
    }*/
    printf("%d",pos[n-1]);
}


#include<bits/stdc++.h>

using namespace std;
int pos[1000005];
int neg[1000005];
int main()
{
    int n;
    scanf("%d",&n);
    long long arr[100005];
    for(int i=0;i<n;i++)
    scanf("%I64d",&arr[i]);
    if(arr[0]<0)
    neg[0]=0;
    else
    neg[0]=1;
    for(int i=1;i<n;i++)
    {
        if(arr[i]>0)
        {
            neg[i]=neg[i-1]+1;
            pos[i]=min(pos[i-1],neg[i-1]);
        }
        else if(arr[i]<0)
        {
            neg[i]=neg[i-1];
            pos[i]=min(pos[i-1],neg[i-1])+1;
        }
        else
        {
            pos[i]=pos[i-1]+1;
            neg[i]=neg[i-1]+1;
        }
    }
    /*for(int i=0;i<n;i++)
    {
        printf("%d ",pos[i]);
    }
        for(int i=0;i<n;i++)
    {
        printf("%d ",neg[i]);
    }*/
    printf("%d",min(pos[n-1],neg[n-1]));
}