Var
a: array[1..16] of integer;
cnt, sum, i: integer;
begin
for i := 1 to 16 do a[i] := -10 + random(21);
for i := 1 to 16 do write(a[i], ' ');
writeln;
for i := 1 to 16 do
if a[i] mod 2 = 0 then write(i, ' ');
for i := 1 to 16 do
if a[i] < 0 then cnt := cnt + 1;
writeln(cnt);
cnt := 0;
for i := 1 to 16 do
if a[i] mod 3 = 0 then
sum := sum + a[i];
writeln(sum);
sum := 0;
for i := 1 to 16 do
if a[i] > 4 then write(a[i], ' ');
writeln();
for i := 1 to 16 do
if a[i] mod 7 <> 0 then
begin
cnt := cnt + 1;
sum := sum + a[i];
end;
writeln(sum / cnt);
cnt := a[8];
a[8] := a[9];
a[9] := cnt;
end.