For this Question: You are given an array P of size N. You have to find the maximum value of <b>P<sub>i</sub> % P<sub>j</sub></b> for all possible i, j pairs.First line contains a single integer N.
The second line of the input contains N space seperated integers.

Constraints:
2 <= N <= 10<sup>5</sup>
1 <= P<sub>i</sub> <= 10<sup>9</sup>Print the maximum value of P<sub>i</sub> % P<sub>j</sub> for all possible i, j pairs in the array.Sample Input:
5
8 6 7 9 4

Sample Output:
8

Explanation:
i = 1, j = 4 (1-based indexing) will give the maximum possible result over all (i, j) pairs., I have written this Solution Code: n=int(input())
arr=list(map(int,input().split()))
arr.sort()

a=0
b=0

for i in range(n):
    if arr[i]>b:
        a=b
        b=arr[i]

print(a%b), In this Programming Language: Python, Now tell me if this Code is compilable or not?