_ = readLine()!
var ps = readLine()!.split(separator: " ").compactMap { Int($0) }

var operationCount = 0

for i in 0..<ps.count {
    if i + 1 == ps[i] {
        operationCount += 1
        if i + 1 < ps.count {
            ps.swapAt(i, i + 1)
        }
    }
}

print(operationCount)
