public static int longestConseqSequence(int[] input) {

        Set<Integer> dedup = new HashSet<>();
        int max = 0;
        if(input == null|| input.length == 0) {
            return max;
        }

        for(int i: input) {
            dedup.add(i);
        }

        for(int i: input) {
            int left = i-1;
            int right =i+1;
            int count = 1;

            while(dedup.contains(left)) {
                count ++;
                dedup.remove(left--);
            }

            while(dedup.contains(right)) {
                count ++;
                dedup.remove(right++);
            }


            max = Math.max(max, count);
        }

        return max;
    }