def ex1( n ):
  total = 0
  for i in range( n ) :
    total += i
  return total
