Killjee and adjacent problem

2

1 votes
Easy
Problem

Killjee has an array A containing N integers {1,2,3,4}. Killjee wants to know how many minimum changes he has to do such that the new array has no two adjacent integers are same.

In 1 change you can change any integer to any number >=1 and <=4.

INPUT

First line of input contains a single integer N, second line contains N space separated integer elements of array A.

OUTPUT

Print single integer, minimum number of changes you need to do.

CONSTRAINTS

1N105

1Ai4

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Changing second elemenet to 3 will suffice.

Editor Image

?