use List::Util qw(min max sum);

use bigint;

my @cnt = split / /, <>;
@cnt = sort {$a <=> $b} @cnt;
$ans = int (($cnt[0] + $cnt[1] + (min ($cnt[2], 2 * ($cnt[0] + $cnt[1])))) / 3);
print $ans, "\n";

use List::Util qw(min max);

use bigint;
use integer;

my @cnt = split / /, <>;
@cnt = sort {$a <=> $b} @cnt;
my $ans = $cnt[0];
$cnt[1] -= $cnt[0];
$cnt[2] -= $cnt[0];
$ans += min ($cnt[1], $cnt[2], ($cnt[1] + $cnt[2]) / 3);
print $ans, "\n";

use List::Util qw(min max);

use bigint;
use integer;

my @cnt = split / /, <>;
@cnt = sort @cnt;
my $ans = $cnt[0];
$cnt[1] -= $cnt[0];
$cnt[2] -= $cnt[0];
$ans += min ($cnt[1], $cnt[2] / 2);
print $ans, "\n";

use List::Util qw(min max);

use bigint;
use integer;

my @cnt = split / /, <>;
@cnt = sort @cnt;
my $ans = $cnt[0];
$cnt[1] -= $cnt[0];
$cnt[2] -= $cnt[0];
$ans += min ($cnt[1], $cnt[2], ($cnt[1] + $cnt[2]) / 3);
print $ans, "\n";

use List::Util qw(min max sum);

use bigint;
use integer;

my @cnt = split / /, <>;
@cnt = sort {$a <=> $b} @cnt;
$ans = ($cnt[0] + $cnt[1] + (min ($cnt[2], 2 * ($cnt[0] + $cnt[1])))) / 3;
print $ans, "\n";

use List::Util qw(min max sum);

use bigint;
use integer;

my @cnt = split / /, <>;
@cnt = sort {$a <=> $b} @cnt;
$cnt[2] = min ($cnt[2], 2 * ($cnt[0] + $cnt[1]));
$ans = (sum @cnt) / 3;
print $ans, "\n";


#!/usr/bin/perl
use strict;
use warnings;

my ($n, $k) = split ' ',<>;
my @input = split ' ', <>;
my @data;
for my $i(0..@input-1){
    push @data, [$input[$i], $i+1];
}
@data = sort {$a->[0] <=> $b->[0]} @data;
my ($sum,@res) = (0,());
foreach(@data){
    last if $sum + $_->[0] > $k;
    $sum += $_->[0];
    push @res, $_->[1];
}
print scalar @res , "\n@res";


<>;

map $h{ $_ } ++, grep $_, split ' ', <>;

print 0 + keys %h

#!/usr/bin/perl

use warnings;
use strict;

$\ = $/;

while(<>){

	my %h;

	map $h{ $_ } ++, grep $_ > 0, split ' ', <>;

	print 0 + keys %h;
	}


#!/usr/bin/perl -wl

use strict;

while( <> ){
    my( $n, $k ) = split;
    my( $min ) = sort { $a <=> $b } $n - $k, $k - 1;

    print $n + $n - 1 + $min + 1 + $n;
    }

#!/usr/bin/perl -wl
use strict;

while (<>) {
    my ($n, $k) = split;
    my ($step) = sort {$a <=> $b} ($n - $k, $k - 1);
    $step += $n - 1;
    print $step + 2 * $n + 1;
}


#!/usr/bin/perl
# your code goes here
use v5.10;

chomp($len = <>);
chomp($line = <>);
@a = split //, $line;
$i = 0;
$ans = 0;
while ($i < $len) {
	$j = $i++;
	while ($i<$len && $a[$i] eq $a[$j]) {
		++$i;
	}
	$ans += $i-$j-1;
}
say $ans;

use strict;
use warnings;

my $stones = <>;
chomp($stones);

my $in = <>;
chomp($in);
my @s = split('', $in);

my $n=0;

# r b g
# if ff or bb or gg we have to remove one stone
# if this stone==next stone, remove this stone. move to next....

for (my $i=0; $i<$stones-1; $i++) {
    if ($s[$i] eq $s[$i+1]) {
        $n++;
    }
}

print $n;

use strict;
use warnings;

<>;
$_ = <>;
chomp;
my @l = split '';
my $res = 0;
for my $i (1..@l-1) {
    $res++ if ($l[$i] eq $l[$i-1]);
}
print "$res\n";

#!/usr/bin/perl
use strict;
use warnings;

chomp(my $n = <STDIN>);
chomp(my $s = <STDIN>);

my @chrs = split("", $s);
my $i = 0;
my $cnt = 0;
while ($i < ($n - 1)) {
    if ($chrs[$i] eq $chrs[$i + 1]) {
        # <STDIN>;
        splice(@chrs, $i, 1);
        $cnt += 1;
        $n -= 1;
    } else {
        $i += 1;
    }
}
print $cnt;
# print $n;
# print $s;

<STDIN>;
@str = split(//, <STDIN>);
$count = 0;

for($i = 0; $i < $#str; $i++)
{
    if($str[$i] eq $str[$i + 1])
    {
        ++$count;
    }
}
print STDOUT $count;

<stdin>; chomp($_ = <stdin>); my ($last, $res)=("", 0); for(split("")){ if( $last eq $_ ){ $res += 1 }else{ $last = $_ } } print "$res\n"

#!/bin/perl

$n = <STDIN>;
$s = <STDIN>;
chomp $s;

$s =~ s/R+/c/g;
$s =~ s/G+/c/g;
$s =~ s/B+/c/g;

print ( $n - length $s );

#!/usr/bin/perl
use strict; use warnings;

my $n = <STDIN>; $_ = <STDIN>;
foreach my $c (qw[R G B]) { s/$c+/$c/g }
print $n + 1 - length . "\n";

#!/usr/bin/perl

use strict;
use warnings;

<>;
chomp($_ = <>);
my @a = split //;
my $res = 0;
my $pre = shift @a;
while (@a) {
    my $cur = shift @a;
    ++$res if $pre eq $cur;
    $pre = $cur;
}
print "$res\n";

#!/bin/perl

$n = <STDIN>;
$s = <STDIN>;
chomp $s;

$b = $s;

$s =~ s/R+/c/;
$s =~ s/G+/c/;
$s =~ s/B+/c/;

print ( ( length $b ) - ( length $s ) );


#!/usr/bin/perl

$PI=3.14159265358979323846;
$MOD=1000000007;

#    <>=~/ /;
#    <>=~/ (\d+) /;
#    <>=~/ (\d+) (\d+) /;

<>;
@_=split/ /,<>;
chomp (@_);
@_= sort num_rev @_;
$first = shift @_;
$last = pop @_;
@_= reverse @_;
unshift @_, $first;
push @_, $last;
print "@_";

#***********SUBS************

sub num {$a <=> $b}
sub num_rev {$b <=> $a}
sub rev {$b cmp $a}

sub p{print}
sub n{print "\n"}
sub pn{p,n}
sub pn_mas {pn for @_}

# Transpose "charbox"
sub transpose{
    $i=@m=@_;
    chomp @m;
    while ($i--){
        $t[$i]=~s/$/chop/e for @m
    }
return @t
}

# Transpose "value sets"
sub transpose_space{
    my @t;
    for (@_){
        my $j=0;
        s/\d+/($t[$j++].="$& ")?$&:$&/eg;
        }
    chop @t;
return @t
}

sub div{
    my ($n, $k)=@_;
return ($n - $n % $k) / $k
}

sub uniq{
    my @m=sort @_;
    push @u, my $i=shift @m;
    for (@m){
        $i eq $_ or push @u, $_;
        $i=$_;
        }
return @u
}

sub max{
    my $max=shift;
    $max<$_ and $max=$_ for @_;
return $max
}

sub min{
    my $min=shift;
    $min>$_ and $min=$_ for @_;
return $min
}

# count (kas_ieskoma, masyvas)
sub count{
    my $i=0;
    $_ eq $_[0] and $i++ for @_;
return --$i
}

#!/usr/bin/perl

$PI=3.14159265358979323846;
$MOD=1000000007;

#    <>=~/ /;
#    <>=~/ (\d+) /;
#    <>=~/ (\d+) (\d+) /;

<>;
@_=split/ /,<>;
chomp (@_);
@_= sort num_rev @_;
$first = shift @_;
$last = pop @_;
@_= sort @_;
unshift @_, $first;
push @_, $last;
print "@_\n";

#***********SUBS************

sub num {$a <=> $b}
sub num_rev {$b <=> $a}
sub rev {$b cmp $a}

sub p{print}
sub n{print "\n"}
sub pn{p,n}
sub pn_mas {pn for @_}

# Transpose "charbox"
sub transpose{
    $i=@m=@_;
    chomp @m;
    while ($i--){
        $t[$i]=~s/$/chop/e for @m
    }
return @t
}

# Transpose "value sets"
sub transpose_space{
    my @t;
    for (@_){
        my $j=0;
        s/\d+/($t[$j++].="$& ")?$&:$&/eg;
        }
    chop @t;
return @t
}

sub div{
    my ($n, $k)=@_;
return ($n - $n % $k) / $k
}

sub uniq{
    my @m=sort @_;
    push @u, my $i=shift @m;
    for (@m){
        $i eq $_ or push @u, $_;
        $i=$_;
        }
return @u
}

sub max{
    my $max=shift;
    $max<$_ and $max=$_ for @_;
return $max
}

sub min{
    my $min=shift;
    $min>$_ and $min=$_ for @_;
return $min
}

# count (kas_ieskoma, masyvas)
sub count{
    my $i=0;
    $_ eq $_[0] and $i++ for @_;
return --$i
}

#!/usr/bin/perl

$PI=3.14159265358979323846;
$MOD=1000000007;

#    <>=~/ /;
#    <>=~/ (\d+) /;
#    <>=~/ (\d+) (\d+) /;

<>;
@_=split/ /,<>;
@_= sort num_rev @_;
$first = shift @_;
$last = pop @_;
@_= sort @_;
unshift @_, $first;
push @_, $last;
print "@_";

#***********SUBS************

sub num {$a <=> $b}
sub num_rev {$b <=> $a}
sub rev {$b cmp $a}

sub p{print}
sub n{print "\n"}
sub pn{p,n}
sub pn_mas {pn for @_}

# Transpose "charbox"
sub transpose{
    $i=@m=@_;
    chomp @m;
    while ($i--){
        $t[$i]=~s/$/chop/e for @m
    }
return @t
}

# Transpose "value sets"
sub transpose_space{
    my @t;
    for (@_){
        my $j=0;
        s/\d+/($t[$j++].="$& ")?$&:$&/eg;
        }
    chop @t;
return @t
}

sub div{
    my ($n, $k)=@_;
return ($n - $n % $k) / $k
}

sub uniq{
    my @m=sort @_;
    push @u, my $i=shift @m;
    for (@m){
        $i eq $_ or push @u, $_;
        $i=$_;
        }
return @u
}

sub max{
    my $max=shift;
    $max<$_ and $max=$_ for @_;
return $max
}

sub min{
    my $min=shift;
    $min>$_ and $min=$_ for @_;
return $min
}

# count (kas_ieskoma, masyvas)
sub count{
    my $i=0;
    $_ eq $_[0] and $i++ for @_;
return --$i
}

#!/usr/bin/perl

$PI=3.14159265358979323846;
$MOD=1000000007;

#    <>=~/ /;
#    <>=~/ (\d+) /;
#    <>=~/ (\d+) (\d+) /;

<>;
@_=split/ /,<>;
@_= sort num_rev @_;
$first = shift @_;
$last = pop @_;
@_= sort @_;
print $first, " @_ ", $last;

#***********SUBS************

sub num {$a <=> $b}
sub num_rev {$b <=> $a}
sub rev {$b cmp $a}

sub p{print}
sub n{print "\n"}
sub pn{p,n}
sub pn_mas {pn for @_}

# Transpose "charbox"
sub transpose{
    $i=@m=@_;
    chomp @m;
    while ($i--){
        $t[$i]=~s/$/chop/e for @m
    }
return @t
}

# Transpose "value sets"
sub transpose_space{
    my @t;
    for (@_){
        my $j=0;
        s/\d+/($t[$j++].="$& ")?$&:$&/eg;
        }
    chop @t;
return @t
}

sub div{
    my ($n, $k)=@_;
return ($n - $n % $k) / $k
}

sub uniq{
    my @m=sort @_;
    push @u, my $i=shift @m;
    for (@m){
        $i eq $_ or push @u, $_;
        $i=$_;
        }
return @u
}

sub max{
    my $max=shift;
    $max<$_ and $max=$_ for @_;
return $max
}

sub min{
    my $min=shift;
    $min>$_ and $min=$_ for @_;
return $min
}

# count (kas_ieskoma, masyvas)
sub count{
    my $i=0;
    $_ eq $_[0] and $i++ for @_;
return --$i
}

#!/usr/bin/perl

$PI=3.14159265358979323846;
$MOD=1000000007;

#    <>=~/ /;
#    <>=~/ (\d+) /;
#    <>=~/ (\d+) (\d+) /;

<>;
@_=split/ /,<>;
chomp (@_);
@_= sort num_rev @_;
$first = shift @_;
$last = pop @_;
@_= sort @_;
unshift @_, $first;
push @_, $last;
print "@_";

#***********SUBS************

sub num {$a <=> $b}
sub num_rev {$b <=> $a}
sub rev {$b cmp $a}

sub p{print}
sub n{print "\n"}
sub pn{p,n}
sub pn_mas {pn for @_}

# Transpose "charbox"
sub transpose{
    $i=@m=@_;
    chomp @m;
    while ($i--){
        $t[$i]=~s/$/chop/e for @m
    }
return @t
}

# Transpose "value sets"
sub transpose_space{
    my @t;
    for (@_){
        my $j=0;
        s/\d+/($t[$j++].="$& ")?$&:$&/eg;
        }
    chop @t;
return @t
}

sub div{
    my ($n, $k)=@_;
return ($n - $n % $k) / $k
}

sub uniq{
    my @m=sort @_;
    push @u, my $i=shift @m;
    for (@m){
        $i eq $_ or push @u, $_;
        $i=$_;
        }
return @u
}

sub max{
    my $max=shift;
    $max<$_ and $max=$_ for @_;
return $max
}

sub min{
    my $min=shift;
    $min>$_ and $min=$_ for @_;
return $min
}

# count (kas_ieskoma, masyvas)
sub count{
    my $i=0;
    $_ eq $_[0] and $i++ for @_;
return --$i
}


#!/usr/bin/perl

use warnings;
use strict;

$\ = $/;

my $debug = 0;

while(!eof){
	$_ = join '', map ~~<>, 1 .. 4;
	y/./,/;

	my @rxs;

	for my $join ( map { '.' x $_ } 0, 3, 4, 5 ){
		for my $arrange ( 'xx,xx' =~ /(?=(...))/g ){
			push @rxs, join $join, split '', $arrange;
			}
		}

	my $re = join '|', @rxs;

	$debug and print $re;

	print /$re/gs ? "YES" : "NO";

	$debug and print "pos:", pos, "[$&]";
	}

#!/usr/bin/perl

use warnings;
use strict;

$\ = $/;

my $debug = 0;

while(!eof){
	$_ = join '', split ' ', join '', map ~~<>, 1 .. 4;
	y/./,/;

	my @rxs;

	for my $join ( map { '[^o]' x $_ } 0, 2, 3, 4 ){
		for my $arrange ( 'xx,xx' =~ /(?=(...))/g ){
			push @rxs, join $join, split '', $arrange;
			}
		}

	$debug and print "/xx,|x,x|,xx|x...x...,|x...,...x|,...x...x|x....x....,|x....,....x|,....x....x|/";

	my $re = join '|', @rxs;

	$debug and print $re;

	print /$re/ ? "YES" : "NO";

	}