AlgoUniversity
  • Go Back
Discussion
Max Employees :

Author

Shikhar Mehrotra

Difficulty Level : Easy

Submissions : 141

Asked In : Slice

Marks :10

: 3 | : 1

One day the manager at a fintech company decides to create a team for the next project. There are a total of n employees and the skill-level of $$$i_{th}$$$ employee is $$$A[i]$$$.

He thinks that the more employees a project has, the easier it gets to work and the project would be finished in fewer days. So he decides to create a team with the maximum number of employees possible. But there must be a balance factor within the team, so the manager decides to create a team in such a way that the skill-level of each pair of employees within the team would differ by no more than 5.

Your task is to help the manager find the maximum number of employees that could be accommodated in the team.

Input

The first line contains a single integer $$$1\le N \le 10^{5}$$$.

The second line contains $$$N$$$ space-separated integers , where $$$1\le i_{th} \le N$$$ integer denotes $$$1 \le A[i] \le 10^{9}$$$.

Output

Output a single integer denoting the maximum employees that could be accomodated in the team.

Examples

Input
8
4 17 8 24 6 10 12 9
Output
4
Input
6
1 10 17 12 15 2
Output
3

Note

In first test case we can chose employees with skills $$$4,8,6,9$$$ .

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.