Counting Beads
题号:NC24737
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
64bit IO Format: %lld

题目描述

Bessie has spilled her collection of N (1 <= N <= 80) blue and orange cowbeads (represented as 1s and 0s, respectively, in the human world) on the floor. She cleans up the mess by arranging the beads into a long line. She then counts the number of times a blue bead is next to an orange bead and vice versa, but is not sure if she is correct. Write a program to validate Bessie's count.

输入描述:

* Line 1: A single integer: N
* Line 2: Line 2 contains N integers, each of which is 0 or 1

输出描述:

* Line 1: A single integer describing the number of occurrences that a blue bead is next to an orange bead and vice versa.
示例1

输入

复制
6
1 0 0 1 1 1

输出

复制
2