Longest Subarray With Sum Divisible By K

easy
1. You are given an array of integers(arr) and a number K.
2. You have to find length of the longest subarray whose sum is divisible by K.

Input Format

A number N arr1 arr2.. N numbers A number K

Output Format

A number representing length of the longest subarray whose sum is divisible by K.

Constraints

1 <= N,K <= 10^5
-1000 <= arr[i] <= 1000

Example

Input
6
2 7 6 1 4 5
3
Output
4
Previous
Word Pattern
Next
Gradings

Related Questions