
const minInt as integer = &H80000000
const maxInt as integer = &H7FFFFFFF

function Minimum(a() as integer) as integer
  dim result as integer = maxInt
  for x as integer = lbound(a) to ubound(a)
    if a(x) < result then result = a(x)
  next x
  return result
end function

function Maximum(a() as integer) as integer
  dim result as integer = minInt
  for x as integer = lbound(a) to ubound(a)
    if a(x) > result then result = a(x)
  next x
  return result
end function

function NumberOf(a() as integer, n as integer) as integer
  dim result as integer = 0
  for x as integer = lbound(a) to ubound(a)
    if a(x) = n then result += 1
  next x
  return result
end function

function IndexOf(a() as integer, n as integer) as integer
  dim result as integer = 0
  dim x as integer = lbound(a)
  do while (x <= ubound(a)) and (result = 0)
    if a(x) = n then result = x else x += 1
  loop
  return result
end function
