Introductory Problems | CSES

Posted on Jan 1, 0001

Distinct Numbers

You are given a list of n integers, and your task is to calculate the number of distinct values in the list.

#include <bits/stdc++.h>

using namespace std;

int main()
    int n, e;
    cin >> n;
    unordered_map<int, int> mp;
    for (int i = 0; i < n; i++)
        cin >> e;
    cout << mp.size();
    return 0;