import java.util.*;


public class Solution {
    /**
     * max increasing subsequence
     * @param arr int整型一维数组 the array
     * @return int整型
     */
    public int MLS (int[] arr) {
        // write code here
        if (arr == null || arr.length < 1) {
            return 0;
        }
        int n = arr.length;
        Arrays.sort(arr);
        int cnt = 1;
        int max = 0;
        for (int i = 1; i < n; i++) {
            if (arr[i] == arr[i - 1]) {
                continue;
            }
            if (arr[i] - arr[i - 1] == 1) {
                cnt++;
            } else {
                cnt = 1;
            }
            max = Math.max(cnt, max);
        }
        return max;
    }
}