blob: c8008e63c0e8d1696938a13c2ee1d902302f02c6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
var
n, i: uint16;
a: array of int64;
begin
readln(n);
setlength(a, n);
for i := 0 to n - 1 do
read(a[i]);
for i := 1 to n - 2 do
if (a[i] < a[i - 1]) and
(a[i] < a[i + 1]) then
begin
dec(n);
a[i] := a[i - 1]
end;
writeln(length(a) - n)
end.
|