#include <bits/stdc++.h>
using namespace std;
bool markP[100007];
vector<int> prime;
inline void sieve() {
  int i, j;
  for (i = 2; i * i <= 100007; ++i)
    if (!markP[i])
      for (j = i << 1; j < 100007; j += i)
        if (!markP[j]) markP[j] = 1;
  prime.push_back(2);
  for (i = 3; i < 100007; i += 2)
    if (!markP[i]) prime.push_back(i);
}
inline void inp(int &x) {
  register int c = getchar();
  x = 0;
  bool neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x * 10) + (c - 48);
  }
  if (neg) x = -x;
}
inline long long int modexp(long long int a, long long int b,
                            const long long int &mod) {
  long long int x = 1;
  while (b > 0) {
    if (b & 1) {
      x *= a;
      if (x >= mod) x %= mod;
    };
    b >>= 1;
    a *= a;
    if (a >= mod) a %= mod;
  }
  return x;
}
inline long long int mulmod(long long int a, long long int b,
                            const long long int &mod) {
  long long int x = 0;
  a %= mod;
  while (b > 0) {
    if (b & 1) {
      x += a;
      if (x >= mod) x %= mod;
    }
    a <<= 1;
    if (a >= mod) a %= mod;
    b >>= 1;
  }
  return x;
}
inline long long int invmod(const long long int &a, const long long int &mod) {
  return modexp(a, mod - 2, mod);
}
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b > 0) {
    if (b & 1) x = (x * a);
    a *= a;
    b >>= 1;
  }
  return x;
}
inline long long int digSum(long long int n) {
  long long int s = 0;
  n = abs(n);
  while (n) {
    s += (n % 10);
    n /= 10;
  }
  return s;
}
inline long long int strmod(const string &T, const long long int &mod) {
  long long int mul = 0;
  for (int i = (0); i <= ((int(T.length())) - 1); ++i) {
    mul = (mul * 10 + T[i] - 48);
    if (mul >= mod) mul %= mod;
  }
  return mul;
}
inline bool isPrime(const long long int &x) {
  if (x <= 3) return (x <= 1 ? 0 : 1);
  if (!(x & 1) || !(x % 3)) return 0;
  for (long long int i = 5; i * i <= x; i += 6)
    if (!(x % i) || !(x % (i + 2))) return 0;
  return 1;
}
inline bool isPalin(const string &st) {
  int l = (int(st.length()));
  for (int i = 0; (i << 1) < l; ++i)
    if (st[i] != st[l - i - 1]) return 0;
  return 1;
}
inline long long int fib(long long int n) {
  long long int i, j, h, k, t;
  i = h = 1;
  j = k = 0;
  while (n > 0) {
    if (n & 1) {
      t = j * h;
      j = (i * h + j * k + t);
      i = (i * k + t);
    }
    t = h * h;
    h = (2 * k * h + t);
    k = (k * k + t);
    n >>= 1;
  }
  return j;
}
inline long long int comb(const long long int &N, long long int R,
                          const long long int &mod) {
  R > (N - R) ? (R = N - R) : R;
  long long int mul = 1LL;
  for (int i = (0); i <= (R - 1); ++i)
    mul = ((mul * (N - i)) % mod * invmod(i + 1, mod)) % mod;
  return mul;
}
inline int elePos(int *A, const int &n, const int &x) {
  int l = 0, h = n - 1, m;
  while (l <= h) {
    m = (h + l) >> 1;
    if (x == A[m]) return (m + 1);
    (x < A[m]) ? (h = m - 1) : (l = m + 1);
  }
  return -1;
}
inline bool cmp(const pair<int, int> &X, const pair<int, int> &Y) {
  return (X.first != Y.first) ? (X.first < Y.first) : (X.second < Y.second);
}
int A[100007];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = (0); i <= (n - 1); ++i) cin >> A[i];
  sort(A, A + n);
  long long int sum = A[0];
  int ans = 1;
  for (int i = 1; i < n;) {
    if (A[i] >= sum) {
      sum += A[i];
      ++ans;
      ++i;
    } else
      while (i < n && A[i] < sum) i++;
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Your challenge is to write a cpp solution to the following problem:

Little girl Susie went shopping with her mom and she wondered how to improve service quality. 

There are n people in the queue. For each person we know time ti needed to serve him. A person will be disappointed if the time he waits is more than the time needed to serve him. The time a person waits is the total time when all the people who stand in the queue in front of him are served. Susie thought that if we swap some people in the queue, then we can decrease the number of people who are disappointed. 

Help Susie find out what is the maximum number of not disappointed people can be achieved by swapping people in the queue.

Input

The first line contains integer n (1 ≤ n ≤ 105).

The next line contains n integers ti (1 ≤ ti ≤ 109), separated by spaces.

Output

Print a single number — the maximum number of not disappointed people in the queue.

Examples

Input

5
15 2 1 5 3


Output

4

Note

Value 4 is achieved at such an arrangement, for example: 1, 2, 3, 5, 15. Thus, you can make everything feel not disappointed except for the person with time 5.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool markP[100007];
vector<int> prime;
inline void sieve() {
  int i, j;
  for (i = 2; i * i <= 100007; ++i)
    if (!markP[i])
      for (j = i << 1; j < 100007; j += i)
        if (!markP[j]) markP[j] = 1;
  prime.push_back(2);
  for (i = 3; i < 100007; i += 2)
    if (!markP[i]) prime.push_back(i);
}
inline void inp(int &x) {
  register int c = getchar();
  x = 0;
  bool neg = 0;
  for (; ((c < 48 || c > 57) && c != '-'); c = getchar())
    ;
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  for (; c > 47 && c < 58; c = getchar()) {
    x = (x * 10) + (c - 48);
  }
  if (neg) x = -x;
}
inline long long int modexp(long long int a, long long int b,
                            const long long int &mod) {
  long long int x = 1;
  while (b > 0) {
    if (b & 1) {
      x *= a;
      if (x >= mod) x %= mod;
    };
    b >>= 1;
    a *= a;
    if (a >= mod) a %= mod;
  }
  return x;
}
inline long long int mulmod(long long int a, long long int b,
                            const long long int &mod) {
  long long int x = 0;
  a %= mod;
  while (b > 0) {
    if (b & 1) {
      x += a;
      if (x >= mod) x %= mod;
    }
    a <<= 1;
    if (a >= mod) a %= mod;
    b >>= 1;
  }
  return x;
}
inline long long int invmod(const long long int &a, const long long int &mod) {
  return modexp(a, mod - 2, mod);
}
inline long long int power(long long int a, long long int b) {
  long long int x = 1;
  while (b > 0) {
    if (b & 1) x = (x * a);
    a *= a;
    b >>= 1;
  }
  return x;
}
inline long long int digSum(long long int n) {
  long long int s = 0;
  n = abs(n);
  while (n) {
    s += (n % 10);
    n /= 10;
  }
  return s;
}
inline long long int strmod(const string &T, const long long int &mod) {
  long long int mul = 0;
  for (int i = (0); i <= ((int(T.length())) - 1); ++i) {
    mul = (mul * 10 + T[i] - 48);
    if (mul >= mod) mul %= mod;
  }
  return mul;
}
inline bool isPrime(const long long int &x) {
  if (x <= 3) return (x <= 1 ? 0 : 1);
  if (!(x & 1) || !(x % 3)) return 0;
  for (long long int i = 5; i * i <= x; i += 6)
    if (!(x % i) || !(x % (i + 2))) return 0;
  return 1;
}
inline bool isPalin(const string &st) {
  int l = (int(st.length()));
  for (int i = 0; (i << 1) < l; ++i)
    if (st[i] != st[l - i - 1]) return 0;
  return 1;
}
inline long long int fib(long long int n) {
  long long int i, j, h, k, t;
  i = h = 1;
  j = k = 0;
  while (n > 0) {
    if (n & 1) {
      t = j * h;
      j = (i * h + j * k + t);
      i = (i * k + t);
    }
    t = h * h;
    h = (2 * k * h + t);
    k = (k * k + t);
    n >>= 1;
  }
  return j;
}
inline long long int comb(const long long int &N, long long int R,
                          const long long int &mod) {
  R > (N - R) ? (R = N - R) : R;
  long long int mul = 1LL;
  for (int i = (0); i <= (R - 1); ++i)
    mul = ((mul * (N - i)) % mod * invmod(i + 1, mod)) % mod;
  return mul;
}
inline int elePos(int *A, const int &n, const int &x) {
  int l = 0, h = n - 1, m;
  while (l <= h) {
    m = (h + l) >> 1;
    if (x == A[m]) return (m + 1);
    (x < A[m]) ? (h = m - 1) : (l = m + 1);
  }
  return -1;
}
inline bool cmp(const pair<int, int> &X, const pair<int, int> &Y) {
  return (X.first != Y.first) ? (X.first < Y.first) : (X.second < Y.second);
}
int A[100007];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = (0); i <= (n - 1); ++i) cin >> A[i];
  sort(A, A + n);
  long long int sum = A[0];
  int ans = 1;
  for (int i = 1; i < n;) {
    if (A[i] >= sum) {
      sum += A[i];
      ++ans;
      ++i;
    } else
      while (i < n && A[i] < sum) i++;
  }
  cout << ans << endl;
  return 0;
}

```