Published:
Updated:

https://codeforces.com/problemset/problem/228/A


Solution

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Solution {
    static void printMinNum(List<Integer> input) {
        int count = 0;
        Collections.sort(input);
        for (int i = 0; i < input.size() - 1; i++) {
            if (Objects.equals(input.get(i), input.get(i + 1))) {
                count++;
            }
        }
        System.out.print(count);
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        List<Integer> input = new ArrayList<>();
        StringTokenizer st = new StringTokenizer(br.readLine(), " ");
        while (st.hasMoreTokens()) {
            input.add(Integer.parseInt(st.nextToken()));
        }
        printMinNum(input);
        br.close();
    }
}

Leave a comment