def cc143
    n = gets.chomp.to_i
    s = gets.chomp#.split(/\s/).map{|x| x.to_i}

    cnt = 0
    bc = nil
    s.each_char do |c|
        unless bc == c
            bc = c
            cnt += 1
        end
    end

    puts cnt
end

cc143