    inputs = gets.split(' ').map(&:to_i)
    count = 0

    inputs.each.with_index do |l, j|
      inputs.each.with_index do |n, i|
        count += 1 if inputs[j..i]
      end
    end

    puts count