Pagini recente » Cod sursa (job #1432353) | Rating Jeany Talent (mihnea_96) | Cod sursa (job #200705) | Cod sursa (job #3172207) | Cod sursa (job #120191)
Cod sursa(job #120191)
var v:array[1..9000]of longint;
x,y,m:array[1..7000]of longint;
i,j,n,s,max:longint;
begin
assign(input,'medie.in');reset(input);
assign(output,'medie.out');rewrite(output);
readln(n);
for i:=1 to n do
begin
read(v[i]);
inc(x[v[i]]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
if (v[i]+v[j]) mod 2=0 then
inc(y[(v[i]+v[j]) div 2]);
end;
for i:=1 to n do
if y[v[i]]<>0 then
s:=s+y[v[i]]-x[v[i]]+1;
writeln(s);
close(input);close(output);
end.