/**
 * This exercise requires implementing a function that takes a list as input
 * and counts the number of elements in the list that are not equal to the index they are positioned at.
 *
 * Example:
 * countNotInList(listOf(0, 1, 2, 2, 4))  =>  2
 *
 * Explanation:
 * In the given list [0, 1, 2, 2, 4], the values at index 2 and index 4 are not equal to their respective indices.
 * Therefore, the function should return 2.
 *
 * Your task is to complete the code to solve the exercise.
 *
 * Assumptions:
 * - The list will only contain integers.
 * - The list can be empty.
 *
 * You can use any sequential statements and the '!=' operator to solve this exercise.
 */
fun countNotInList(lst: List<Int>): Int {

    var count = 0
    for ((index, num) in lst.withIndex()) {
        if (num != index) {
            count++
        }
    }
    return count
}
/**
 * This exercise requires implementing a function that takes a list as input
 * and counts the number of elements in the list that are not equal to the index they are positioned at.
 *
 * Example:
 * countNotInList(listOf(0, 1, 2, 2, 4))  =>  2
 *
 * Explanation:
 * In the given list [0, 1, 2, 2, 4], the values at index 2 and index 4 are not equal to their respective indices.
 * Therefore, the function should return 2.
 *
 * Your task is to complete the code to solve the exercise.
 *
 * Assumptions:
 * - The list will only contain integers.
 * - The list can be empty.
 *
 * You can use any sequential statements and the '!=' operator to solve this exercise.
 */
fun countNotInList(lst: List<Int>): Int {
/**
 * This exercise requires implementing a function that takes a list as input
 * and counts the number of elements in the list that are not equal to the index they are positioned at.
 *
 * Example:
 * countNotInList(listOf(0, 1, 2, 2, 4))  =>  2
 *
 * Explanation:
 * In the given list [0, 1, 2, 2, 4], the values at index 2 and index 4 are not equal to their respective indices.
 * Therefore, the function should return 2.
 *
 * Your task is to complete the code to solve the exercise.
 *
 * Assumptions:
 * - The list will only contain integers.
 * - The list can be empty.
 *
 * You can use any sequential statements and the '!=' operator to solve this exercise.
 */
fun countNotInList(lst: List<Int>): Int {

    var count = 0
    for ((index, num) in lst.withIndex()) {
        if (num != index) {
            count++
        }
    }
    return count
}