/*
    In the name of
        "ALLAH"
    And say "AL-HAMD-U-LILLAH"
*/

#include<bits/stdc++.h>
#define   ll   long long
#define   llu  unsigned long long
#define   _    printf("\n")
int      take() {
    int n;
    scanf("%d",&n);
    return n;

}
double  ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll     takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define  Int             take()
#define  Dnt             ttake()
#define  LL              takes()
#define  done            {return 0;}
#define  fr(i,x,n,a)     for(int i=x;i<=n;i+=a)
#define  FR(a,b,x)       for(int i=(a);i<=(b);i+=(x))
#define  rfr(i,x,n,a)    for(int i=x;i>=n;i--)
int      cas;
#define  print           printf("Case %d:",++cas)
#define  vi              vector<int>
#define  vl              vector<ll>
#define  pb              push_back
#define  pii             pair<int,int>
#define  vii             vector<pii>
#define  pll             pair<ll,ll>
#define  pil             pair<int,ll>
#define  pli             pair<ll,int>
#define  pipii           pair<int,pii>
#define  piipi           pair<pii,int>
#define  mk              make_pair
#define  fill(x,v)       memset(x,v,sizeof x)

using    namespace       std;

bool     approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool     definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define  STR             {struct info}
#define  dbg(x)          {cout<<"ekhane"<<x<<endl;}
#define  SS              second
#define  FF              first
#define  PQ              priority_queue
#define  great           greatest
#define  less            lesser
#define  mii             map<int,int>
#define  mil             map<int,ll>
#define  mll             map<ll,ll>
#define  msb             map<string,bool>
#define  V               vector
#define  M               100005
#define  pf              printf
#define  inf             INT_MAX
//////////////////////////////////////////

int main( ){
    int tc = 1 ;
    while( tc-- ){
        int n = Int ,  ans = 0 ;
        vi v1 ;
        fr( i , 1 , n , 1 ){
            v1.pb( Int ) ;
        }
        if( n == 2 || n == 1 ){
            if( n == 1 ) {
                cout<<0;
                done ;
            }
            if( v1[ 0 ] == v1[ 1 ] ) ans++ ;
            cout<<ans<<endl;
            done ;
        }

        for( int i = 1 ; i < v1.size() ; i++ ){
            if( v1[ i ] == v1[ i - 1 ] ){
                if( i + 1 < v1.size() ){
                    if( v1[ i + 1 ] == v1[ i ] ){
                        int x = 1 , y = 10 , z = 100 ;
                        if( x == v1[ i ] ) v1[ i ] = y ;
                        else if( v1[ i ] == y ) v1[ i ] == z ;
                        else v1[ i ] = x ;
                    }else{
                        int x = v1[ i ] , y = v1[ i + 1 ] ;
                        int p = 10 , q = 100 , r = 1000 ;
                        if( p != x && y != p ){
                            v1[ i ] = p ;
                        }else if( q != x && y != q ){
                            v1[ i ] = q ;
                        }else v1[ i ] = r ;
                    }
                }
                    ans++ ;
            }
        }

        cout<<ans<<endl;
    }
    done ;
}



Measured memory_bytes: 256