Răspuns:
#include <iostream>
#include <cmath>
#include <fstream>
using namespace std;
ifstream in("date.in");
ofstream out("date.out");
int f[10000],n,x,vmax=0;
int main()
{
in>>n;
for(int i=1;i<=n;i++)
{
in>>x;
vmax=max(vmax,x);
f[x]++;
}
for(int i=0;i<=vmax;i++)
if(f[i]>=2)
out<<i<<' ';
return 0;
}