TSORT: getting wrong answer

I tried implementing sort using streams as below. Running locally gives me the correct result but I am getting WA. Can anybody please help?

import java.util.Arrays;
import java.util.Scanner;

class TurboSort {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int numbersToSort = sc.nextInt();
        Integer[] arr = new Integer[numbersToSort];
        for (int i = 0; i < numbersToSort; i++) {
            arr[i] = sc.nextInt();
        Arrays.stream(arr).sorted().distinct().forEach(x -> System.out.println(x));


Why are you using .distinct?

thanks a lot!! removing that solved the issue. But can u please explain why this happened. How come adding distinct made it wrong answer.