You are given three piles of casino chips: white, green and black chips:

* the first pile contains only white chips
* the second pile contains only green chips
* the third pile contains only black chips

Each day you take exactly two chips of different colors and head to the casino. You can choose any color, but you are not allowed to take two chips of the same color in a day.

You will be given an array representing the number of chips of each color and your task is to return the maximum number of days you can pick the chips. Each day you need to take exactly two chips.

```python 
solve([1,1,1]) = 1, because after you pick on day one, there will be only one chip left
solve([1,2,1] = 2, you can pick twice; you pick two chips on day one then on day two
solve([4,1,1]) = 2
```

```javascript 
solve([1,1,1]) = 1, because after you pick on day one, there will be only one chip left
solve([1,2,1]) = 2, you can pick twice; you pick two chips on day one then on day two
solve([4,1,1]) = 2
```

```go 
solve([1,1,1]) = 1, because after you pick on day one, there will be only one chip left
solve([1,2,1]) = 2, you can pick twice; you pick two chips on day one then on day two
solve([4,1,1]) = 2
```


```ruby 
solve([1,1,1]) = 1, because after you pick on day one, there will be only one chip left
solve([1,2,1]) = 2, you can pick twice; you pick two chips on day, two chips on day two
solve([4,1,1]) = 2
```

More examples in the test cases. Good luck!

Brute force is not the way to go here. Look for a simplifying mathematical approach.

Difficulty: introductory

Starter code:

def solve(arr):
	

Solutions:
def solve(xs):
    x, y, z = sorted(xs)
    return min(x + y, (x + y + z) // 2)

def solve(arr):
    cnt = 0
    arr.sort()
    while(arr[2]<(arr[0]+arr[1])):
               arr[0]-=1
               arr[1]-=1
               cnt+=1
    return cnt+arr[0]+arr[1]

def solve(arr):
    a,b,c = sorted(arr)
    s = a+b
    if s < c:
        return s
    else:
        return c + int((s-c)/2)

def score(a,b,c):
    if a+b<c: return a+b
    return (a+b-c)//2+c

def solve(arr):
    a,b,c = arr
    return min(score(a,b,c),score(b,c,a),score(c,a,b))

def solve(arr):
    largest = max(arr)
    all = sum(arr)
    
    return all//2 if largest <= all - largest else all - largest

def solve(arr):
    return min(sum(arr) - max(arr), sum(arr) // 2)

def solve(arr):
    a, b, c = sorted(arr)
    return (a + b + min(a+b, c)) // 2

def solve(arr):
    arr.sort()
    d = arr[2]-arr[1]
    if d>arr[0]:
        return arr[0] + arr[1]
    return arr[1]+d +(arr[0]-d)//2

def solve(arr):
    return sum(arr)-max(arr) if max(arr)>sum(arr)-max(arr) else sum(arr)//2

def solve(arr):
    arr.sort()
    days = min(arr[1] + arr[0], arr[2])
    otherDays = (arr[0] + arr[1] + arr[2]) // 2
    if arr[1] + arr[0] - arr[2] < 0:
        return days
    return otherDays