Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each hamster either sat down or stood up.

For another exercise, Pasha needs exactly $\frac{n}{2}$ hamsters to stand up and the other hamsters to sit down. In one minute, Pasha can make some hamster ether sit down or stand up. How many minutes will he need to get what he wants if he acts optimally well?


-----Input-----

The first line contains integer n (2 ≤ n ≤ 200; n is even). The next line contains n characters without spaces. These characters describe the hamsters' position: the i-th character equals 'X', if the i-th hamster in the row is standing, and 'x', if he is sitting.


-----Output-----

In the first line, print a single integer — the minimum required number of minutes. In the second line, print a string that describes the hamsters' position after Pasha makes the required changes. If there are multiple optimal positions, print any of them.


-----Examples-----
Input
4
xxXx

Output
1
XxXx

Input
2
XX

Output
1
xX

Input
6
xXXxXx

Output
0
xXXxXx

Difficulty: interview

Starter code:

Solutions:
n = int(input())
s = list(input())
sit = 0
for i in range(n):
    if s[i] == 'x':
        sit += 1
ans = 0
i = 0
while i < n and sit < n - sit:
    if s[i] == 'X':
        sit += 1
        ans += 1
        s[i] = 'x'
    i += 1
i = 0
while i < n and sit > n - sit:
    if s[i] == 'x':
        sit -= 1
        ans += 1
        s[i] = 'X'
    i += 1
print(ans)
print(''.join(s))

n = int(input())
s = list(input())
x = 0
X = 0
for c in s:
    if c == 'x':
        x += 1
    else:
        X += 1
if x == n / 2:
    print(0)
elif X > x:
    c = (X - x) // 2
    print(c)
    for i in range(n):
        if s[i] == 'X':
           s[i] = 'x'
           c -= 1
           if c == 0:
               break
else:
    c = (x - X) // 2
    print(c)
    for i in range(n):
        if s[i] == 'x':
            s[i] = 'X'
            c -= 1
            if c == 0:
                break
print(''.join(s))


n = int(input())
s = input()
standing = s.count("X")
count = abs(n // 2 - standing)
print(count)
if standing < n // 2:

    print(str.replace(s, "x", "X", count))

else:

    print(str.replace(s, "X", "x", count))


n=int(input(''))
m=list(input(''))


count=0
for i in range(n):
    if m[i]=='X': count+=1
if n/2==count:
    print('0')
    for i in range(n):
        print(m[i],end='')
if n/2>count:
    print(int(n/2-count))
    k=n/2-count
    for i in range(n):
        if m[i]=='x' and k>0:
            print('X',end='')
            k-=1;
        else: print(m[i],end='')
if n/2<count:
    print(int(count-n/2))
    k=count-n/2
    for i in range(n):
        if m[i]=='X' and k>0:
            print('x',end='')
            k-=1;
        else: print(m[i],end='')        
    





            
            
        
        
    


                



n = int(input())
s = input()
diff = (s.count('x') - s.count('X')) // 2
print(abs(diff))
s = list(s)

for i in range(len(s)):
    if s[i] == 'X' and diff < 0:
        s[i] = 'x'
        diff += 1
    elif s[i] == 'x' and diff > 0:
        s[i] = 'X'
        diff -= 1
print(''.join(s))


n = int(input())
s = input().strip()
cntx = 0
cntX = 0
for i in range(n):
    if s[i] == 'x':
        cntx += 1
cntX = n - cntx



if cntx > n // 2:
    c = cntx - n // 2
    print(c)
    for i in range(n):
        if s[i] == 'x' and c > 0:
            print('X', end =  '')
            c -= 1
        else:
            print(s[i], end = '')

else:
    c = cntX - n // 2
    print(c)
    for i in range(n):
        if s[i] == 'X' and c > 0:
            print('x', end =  '')
            c -= 1
        else:
            print(s[i], end = '')
            
            
    

n = int(input())
str = input()
sit = 0
for i in str:
    if (i == 'x'):
        sit += 1
minutes =  abs(n / 2 - sit)
result = ''
if (minutes == 0):
    result = str
else:
    if (sit >= n /2):
        s = 'X'
    else:
        s = 'x'
    l = minutes
    for i in str:
        t = i
        if t != s and l > 0:
            t = s
            l -= 1
        result += t


print("%d" % minutes)
print(result)


n = int(input())
a = input().strip()
cnt = 0
a = list(a)
for i in range(n):
    if a[i] == 'x':
        cnt += 1
res = abs(n // 2 - max(cnt, n - cnt))
print(res)
if cnt > n - cnt:
    for i in range(n):
        if a[i] == 'x' and res:
            a[i] = 'X'
            res -= 1
else:
    for i in range(n):
        if a[i] == 'X' and res:
            a[i] = 'x'
            res -= 1    
print(''.join(a))        

n = int(input())
hamsters = list(input())
count = 0

for i in range(n):
    if hamsters.count('x') == n // 2:
        break
    if hamsters.count('x') > n // 2:
        if hamsters[i] == 'x':
            count += 1
            hamsters[i] = 'X'
    else:
        if hamsters[i] == 'X':
            count += 1
            hamsters[i] = 'x'

print(count)
print(''.join(hamsters))


n = int(input())
position = input()

n_X = int(position.count('X'))
t= 0

if n_X < (n//2):
    ele = n//2 - n_X
    x = 0
    for i in range(n):
        if position[i] == 'x' and x <= ele :
            x += 1
            t += 1
            position = position[:i] + 'X' + position[i+1:]
            if x == ele :
                break
elif n_X > (n//2) :
    ele = n_X - n//2
    x = 0
    for i in range(n):
        if position[i] == 'X' and x <= ele :
            x += 1
            t += 1
            position = position[:i] + 'x' + position[i+1:]
            if x==ele :
                break

print(t)
print(position)


from math import*
n = int(input())
s = input().strip()
c = 0
k = 0
c = s.count("x")
k = s.count("X")
i = 0
otv = []
print(min(abs(n // 2 - c), abs(n // 2 - k)))
if n // 2 - c > n // 2 - k:
    while i < n and c != n // 2:
        if s[i] == "X":
            otv += "x"
            c += 1
        else:
            otv += s[i]
        i += 1
    for j in range(i, n):
        otv += s[j]     
elif n // 2 - c < n // 2 - k:
    while i < n and k != n // 2:
        if s[i] == "x":
            otv += "X"
            k += 1
        else:
            otv += s[i]
        i += 1
    for j in range(i, n):
        otv += s[j]   
else:
    for j in range(n):
        otv += s[j]
print(''.join(otv))



n = int(input())
s = input().strip()
xsmall = s.count('x')
xbig = s.count('X')
if xbig < xsmall:
    print((xsmall - xbig)//2)
    print(s.replace('x', 'X', (xsmall - xbig)//2))
else:
    print((xbig - xsmall)//2)
    print(s.replace('X', 'x', (xbig - xsmall)//2))    

n=int(input())

s=list(input())

X=s.count('X')
x=s.count('x')

ans=0
for i in range(n):
    if(X>x and s[i]=='X'):
        s[i]='x'
        ans+=1
        X-=1
        x+=1
    elif(X<x and s[i]=='x'):
        s[i]='X'
        ans+=1
        X+=1
        x-=1
print(ans)
for item in s:
    print(item,end="")

n, t = int(input()), input()
a, b = 'x', 'X'
k = t.count(a) - n // 2
if k:
    t = list(t)
    if k < 0: a, b, k = b, a, -k
    print(k)
    for i, c in enumerate(t):
        if c == a:
            t[i] = b
            k -= 1
            if k == 0: break
    print(''.join(t))
else: print('0\n' + t)

input()
pos = [(c == 'X') for c in input()]

b = pos.count(True) - len(pos)//2

print (abs(b))

if b < 0:
    for p in range(len(pos)):
        if not pos[p]:
            pos[p] = True
            b += 1
            if b == 0:
                break
elif b > 0:
    for p in range(len(pos)):
        if pos[p]:
            pos[p] = False
            b -= 1
            if b == 0:
                break


print(''.join('X' if p else 'x' for p in pos))

n = int(input())
s = input()
r = (n >> 1) - s.count('x')
c = abs(r)
print(c)
i = 0
if r > 0:
    while c:
        if s[i] == 'X':
            print('x', end = '')
            c -= 1
        else:
            print(s[i], end = '')
        i += 1
    print(s[i:])
elif r < 0:
    while c:
        if s[i] == 'x':
            print('X', end = '')
            c -= 1
        else:
            print(s[i], end = '')
        i += 1
    print(s[i:])
else:
    print(s)

n=int(input())
positions = list(input())
needed = n//2
standing=0
for i in range(n):
    if positions[i] == 'X':
        standing+=1
print(abs(needed-standing))
i=0
while(needed>standing):
    if positions[i] == 'x':
        positions[i] = 'X'
        standing+=1
    i+=1
i=0
while(needed<standing):
    if positions[i] == 'X':
        positions[i] = 'x'
        needed+=1
    i+=1
print(''.join(positions))
 


n = int(input())
s = list(input())
st = s.count('X')
n2 = n // 2
k = abs(n2 -st)
if st > n2:
    for i in range(n):
        if s[i] == 'X': s[i]='x'
        if s.count('X') == n2: break
elif st < n2:
    for i in range(n):
        if s[i] == 'x': s[i]='X'
        if s.count('X') == n2: break
print(k)
print(''.join(s))

n = int(input())
s = input()
m = s.count("X")
count = abs(n//2-m)
print(count)
if m<n//2:
    print(str.replace(s, "x", "X", count))
else:
    print(str.replace(s, "X", "x", count))

#! /usr/bin/env python

n = int(input())
s = list(input())

cnt = s.count('x')
ans = cnt - n // 2;
if ans > 0:
    tmp = ans;
    for i, x in enumerate(s):
        if x == 'x':
            s[i] = 'X'
            tmp -= 1
            if tmp == 0:
                break
elif ans < 0:
    ans = -ans;
    tmp = ans;
    for i, x in enumerate(s):
        if x == 'X':
            s[i] = 'x'
            tmp -= 1
            if tmp == 0:
                break
print(ans)
print(''.join(s))


n = int(input())
s = list(input())
a = s.count("x")
b = s.count("X")
c = "x" if a < b else "X"
k = abs(n // 2 - a)
print(k)
i = 0
while k > 0:
  if s[i] != c:
    s[i] = c
    k -= 1
  i += 1
print("".join(s))

#!/usr/local/bin/python3

n = list(map(int, input()))
a = list(input())
i_x = a.count('x')
i_X = a.count('X')
result = int(abs(i_x-i_X)/2)
print(result)
cnt = 0
if i_x > i_X:
	flag = 1
elif i_x < i_X:
	flag = 0
else:
	flag = -1
for i in range(len(a)):
	if flag == -1:
		break
	if a[i] == 'x':
		if flag == 1:
			a[i] = 'X'
			cnt += 1
	else:
		if flag == 0:
			a[i] = 'x'
			cnt += 1
	if cnt == result:
		break
print("".join(a))


n = int(input())
a = list(input())
xa = a.count('x')
xb = a.count('X')
xc = 'x' if xb > xa else 'X'
result = int(abs(n/2 - xa))
print(result)
for i in a:
    if result == 0:
        break
    if i != xc:
        a[a.index(i)] = xc
        result -= 1
print("".join(a))

n=int(input())
s=input()
if s.count('x')>=s.count('X'):
    print(n//2-s.count('X'))
    s=s.replace('x','X',n//2-s.count('X'))
    print(s)
else:
    print(n//2-s.count('x'))
    s=s.replace('X','x',n//2-s.count('x'))
    print(s)