Const n = 5;
var
a: array[1..n, 1..n] of integer;
i, j, s, k: integer;
sr: real;
begin
s := 0;
for i:=1 to n do
for j:=1 to n do
begin
readln(a[i, j]);
s:=s+a[i, j];
end;
sr := s / sqr(n);
k := 0;
for i:=1 to n do
for j:=1 to n do
if a[i, j] > sr then
inc(k);
writeln(k);
end.