#include // #ifdef DEBUG // #include "cpp-dump/dump.hpp" // #define dump(...) cpp_dump(__VA_ARGS__) // #else // #define dump(...) // #endif using namespace std; typedef long long ll; void solve() { ll n,m,t; cin >> n >> m >> t; vector A(m); for (ll i = 0; i < m; ++i) cin >> A[i]; vector tmp(n); for (ll i = 0; i < m; ++i) { tmp[A[i]-1]++; } priority_queue, vector>, less>> big_que; priority_queue, vector>, greater>> small_que; for (ll i = 0; i < n; ++i) { small_que.push({tmp[i],i}); big_que.push({tmp[i],i}); } ll ans = big_que.top().first; while (1) { pair big = big_que.top(); pair sml = small_que.top(); if (big.first - 1 > sml.first + t) { ans = big.first - 1; big.first -= 1; sml.first += t; big_que.pop(); small_que.pop(); big_que.push(big); small_que.push(sml); } else { break; } } cout << ans << endl; } int main() { solve(); return 0; }