For this Question: For Christmas decoration, Jerry has set up N christmas lights in a row. The brightness of the i<sup>th</sup> light from the left is B[i]. A light at position i is powerful if its brightness is greater than or equal to the sum of brightness of all the lights to its left. Now, Tom wants the number of powerful lights to be maximum so he wants to rearrange the lights so that maximum number of lights are powerful. Find the maximum number of powerful lights, and make Tom and Jerry happy this Christmas.The first line of the input contains a single integer N.
The next line contain N integers denoting array B.

Constraints
1 <= N <= 100000
1 <= B[i] <= 10<sup>15</sup>Print a single integer denoting maximum number of powerful lights after rearrangement.Sample Input 1
5
10 1 3 23 3

Sample Output 1
4

Explanation: we can rearrange the lights as 1 3 10 23 3. In this lights at index 1, 2, 3 and 4 are powerful.

Sample Input 2
5
1 1 1 1 1

Sample Output 2
2, I have written this Solution Code: import java.io.*;
import java.util.*;

public class Main {
  InputStream is;
  PrintWriter out;
  String INPUT = "";

  void solve(int TC) throws Exception {
    int n = ni();
    long[] a = new long[n];
    for(int i=0;i<n;i++) {
      a[i] = nl();
    }
    long sum = 0, ans = 0;
    Arrays.sort(a);
    for(long i: a) {
      if(i >= sum) {
        ++ ans;
        sum += i;
      }
    }
    pn(ans);
  }

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

  void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
  static void dbg(Object... o){System.err.println(Arrays.deepToString(o));}

  void run() throws Exception {
    is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
    out = new PrintWriter(System.out);
    long s = System.currentTimeMillis();
    int T = TestCases ? ni() : 1;
    for(int t=1;t<=T;t++) solve(t);
    out.flush();
    if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");
  }

  void p(Object o) { out.print(o); }
  void pn(Object o) { out.println(o); }
  void pni(Object o) { out.println(o);out.flush(); }

  int ni() {
    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 nl() {
    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();
    }
  }

  double nd() { return Double.parseDouble(ns()); }
  char nc() { return (char)skip(); }

  int BUF_SIZE = 1024 * 8;
  byte[] inbuf = new byte[BUF_SIZE];
  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; }

  String ns() {
    int b = skip();
    StringBuilder sb = new StringBuilder();
    while(!(isSpaceChar(b))) {
      sb.appendCodePoint(b); b = readByte();
    } return sb.toString();
  }

  char[] ns(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);
  }

  void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?