Language: C++

#include <algorithm>//min/max/sort(rand-access it)/merge
#include <array>
#include <bitset>
// #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
// #include <fstream>//ifstream/ofstream
#include <iomanip>//setfill/setw/setprecision/fixed/scientific
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN
#include <list>
#include <queue>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <tuple>
#include <utility>//pair
#include <valarray>
#include <vector>

#define PRIME_SHORT 10007
#define PRIME 1000000007

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<ull, int> puli;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pllll;
typedef pair<ull, ull> pulul;
typedef pair<double, double> pdd;
typedef tuple<int, int, int> ti3;
typedef tuple<int, int, int, int> ti4;

const bool debug = false;

template<typename T> void rar(size_t n, T* a);
template<typename T> void rar2(size_t n, size_t m, T** a);

template<typename T> T ipow(T base, T exp);

inline size_t left(size_t current, bool swap);
inline size_t right(size_t current, bool swap);

template<typename T> inline T griddist(T x, T y, T s, T t);
template<typename T> inline T griddist(pair<T, T> one, pair<T, T> two);
template<typename T> inline T griddist(tuple<T, T> one, tuple<T, T> two);

template<typename T> inline T sqeucldist(T x, T y, T s, T t);
template<typename T> inline T sqeucldist(pair<T, T> one, pair<T, T> two);
template<typename T> inline T sqeucldist(tuple<T, T> one, tuple<T, T> two);

inline ull modadd(ull a, ull b, int mod);
inline ull modmult(ull a, ull b, int mod);

int main(void) {
    int n;
    cin >> n;

    int* arr = new int[n];
    rar(n, arr);
    
    //debug output
    if (debug)
    {
        //1D
        cout << "arr" << endl;
        for (int i = 0; i < n; ++i)
        {
            cout << arr[i] << "\t";
        }
        //2D
        cout << "\nrra" << endl;
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < m; ++j)
            {
                cout << rra[i][j] << "\t";
            }
            cout << endl;
        }
    }

    sort(arr.begin(), arr.end());

    int mine = arr[0];
    int maxe = arr[n-1];

    vector<int> counter(maxe+1, 0);

    for (size_t i = 0; i < n; ++i) {
        ++counter[arr[i]];
    }

    int totalcount = 0;

    for (size_t i = 0; i <= maxe; ++i) {
        if (counter[i] > 1) {
            totalcount += counter[i] - 1;
        }
    }

    cout << totalcount << endl;

    return 0;
}

template<typename T>
void rar(size_t n, T* a) {
    for (size_t i = 0; i < n; ++i) cin >> a[i];
    return;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:80:33: error: 'm' was not declared in this scope
   80 |             for (int j = 0; j < m; ++j)
      |                                 ^
a.cc:82:25: error: 'rra' was not declared in this scope; did you mean 'rar'?
   82 |                 cout << rra[i][j] << "\t";
      |                         ^~~
      |                         rar
a.cc:88:14: error: request for member 'begin' in 'arr', which is of non-class type 'int*'
   88 |     sort(arr.begin(), arr.end());
      |              ^~~~~
a.cc:88:27: error: request for member 'end' in 'arr', which is of non-class type 'int*'
   88 |     sort(arr.begin(), arr.end());
      |                           ^~~