import re

input();print(re.sub(r'o(go)+','***',input()))

# Made By Mostafa_Khaled

#!/usr/bin/env python3

from sys import stdin
import re

def main():
    n, = stdin_get_ints_from_line()
    s = stdin_get_string_from_line()

    print(re.sub(r'(ogo((go)+)?)', '***', s))

def stdin_get_ints_from_line():
    return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
    return list(int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_string_from_line():
    return stdin.readline().strip()

if __name__ == '__main__':
    main()

n = int(input())
s = input()
rets = ""
nex = 'o'
hold = ""
for char in s:
    if char == nex:
        hold += char
        if nex == 'o':
            nex = 'g'
        else:
            nex = 'o'
    else:
        if len(hold) > 2:
            rets += "***"
            if hold[-1] == 'g':
                rets += 'g'
        else:
            rets += hold
        hold = ""
        nex = 'o'
        if char == 'o':
            hold += char
            nex = 'g'
        else:
            rets += char

if len(hold) > 2:
    rets += "***"
    if hold[-1] == 'g':
        rets += 'g'
else:
    rets += hold

print(rets)

n = input()
s = input()
while ('ogo' in s):
	x = 'ogo'
	while (x in s): x += 'go'
	x = x[:-2]
	s = s.replace(x,'***')

print(s)

import re
input()
print(re.sub(r"ogo(go)*", "***", input()))

n = int(input())
word = input()
sub = "ogo"
if sub not in word:
    print(word)

else:
    for i in range(n-3,-1,-1):
        if ("ogo"+("go"*i)) in word:
            word = word.replace(("ogo"+("go"*i)), "***")

    print(word)

input()
s = input()
for i in range(100, -1, -1):
	s = s.replace('ogo'+'go'*i, '***')

print(s)

# python2
import sys, threading, os.path
import collections, heapq, math,bisect

sys.setrecursionlimit(10**6) # max depth of recursion
threading.stack_size(2**27)

def main():
    if os.path.exists('input.txt'):
        input = open('input.txt', 'r')
    else:
        input = sys.stdin
    #--------------------------------INPUT---------------------------------
    n = int(input.readline())
    s = list(str(input.readline()))
    init = [0]*(n+1)
    rep,res = '***',''
    temp = 0
    tr = []
    for i in range(n):
        if i!=0 and i+1!=n and s[i]=='g' and s[i-1]=='o' and s[i+1]=='o':
            tr.append(i)

    #print tr
    for i in range(n):
        cond = -1
        for j,x in enumerate(tr):
            if i==x:
                cond = 1
                break
            elif i+1==x or i-1==x :
                cond = 0
                break
        if cond==-1:
            res+=s[i]
        elif cond==1:
            if s[i-2]=='g' and s[i-3]=='o':
                continue
            res+=rep
        elif cond ==0:
            continue

    output = res
    #-------------------------------OUTPUT----------------------------------
    if os.path.exists('output.txt'):
        open('output.txt', 'w').writelines(str(output))
    else:
        sys.stdout.write(str(output))

threading.Thread(target=main).start()

t=int(raw_input())
s=str(raw_input())
ind=s.find('ogo')
while(ind>=0):
	b=ind
	e=ind+3
	p=1;q=0
	#print ind,p,q
	while p==1 or q==1:
		p=0;q=0
		if(b-2>=0 and s[b-2:b]=='og'):
			b-=2
			p=1
		if(e+1<=(t-1) and s[e:e+2]=='go'):
			e+=2
			q=1
		#print s[e:e+2],e
	s=s.replace(s[b:e],'***',1)

	ind=s.find('ogo')
print s

from math import ceil
n = int(input())
x = input()
p = ['ogo']+['ogo'+'go'*i for i in range(1,50)]
j = ceil((n-3)/2)
if n<3:
    print(x)
else:
    while j>=0:
        if p[j] in x:
            x = x.replace(p[j],'***')
        else:
            j = j-1
    print(x)

from math import ceil
input()
x = input()
for i in range(100, 0, -1):
    ss = 'o' + 'go' * i
    while ss in x:
        x = x.replace(ss,'***')
print(x)

_ = raw_input()
s = raw_input()
for i in xrange(50, 0, -1):
    s = s.replace('o'+'go'*i, '***')
print s

n=int(raw_input())
s=raw_input()
i=0
lst=[]
while i < n:
    if s[i]=='o':
        filler ='o'
        while s[i+1:i+3]=='go':
            filler+=s[i+1:i+3]
            i+=2
        if filler!='o':
            lst.append(filler)
        i+=1
    else:
        i+=1
for filler in lst:
    s=s.replace(filler,'***',1)
print s

import re
n = int(input())
s = input()
res = re.sub(r'ogo(go)*', '***', s)
print(res)

import re

interview = int(input())
speech = input()

speech = re.sub(r'ogo(go)*', '***', speech)
print(speech)

from sys import stdin, stdout
n = int(stdin.readline())
s = stdin.readline().strip()
ans = ''

i = 0
while (i < n):
    if i + 2 < n and s[i:i + 3] == 'ogo':
        last = i + 3
        while last + 1 < n and s[last: last + 2] == 'go':
            last += 2
        ans += '***'
        i = last
    else:
        ans += s[i]
        i += 1
stdout.write(ans)

def search(pat, txt, q):
    M = len(pat)
    N = len(txt)
    i = 0
    j = 0
    p = 0
    t = 0
    h = 1
    d = 256
    l = list()

    for i in range(M-1):
        h = (h*d)%q

    for i in range(M):
        p = (d*p + ord(pat[i]))%q
        t = (d*t + ord(txt[i]))%q

    for i in range(N-M+1):
        if p==t:
            for j in range(M):
                if txt[i+j] != pat[j]:
                    break
            j+=1
            if j==M:
                l.append(i)

        if i < N-M:
            t = (d*(t-ord(txt[i])*h) + ord(txt[i+M]))%q

            if t < 0:
                t = t+q

    return l

n = int(input())
txt = input()
pat = 'ogo'
if len(txt) < 3:
    print(txt)
else:
    ll = search(pat, txt, 101)
    s = ''
    prev = -5
    flag = False
    count = 0

    for i in range(len(txt)):
        if i in ll:
            if i-2 != prev:
                s += ('*'*3)
            prev = i
            count = 2
        else:
            if count:
                count -= 1
            else:
                s += txt[i]

    print(s)

n = int(input())
s = input()
m = max((n - 1) // 2, 1)
a = [''] * m
a[0] = 'ogo'
for i in range(1, m):
    a[i] = a[i - 1] + 'go'
for pattern in a[::-1]:
    s = s.replace(pattern, '***')
print(s)

def process(s, start, end):
    if start != -1 and end != -1:
        for i in xrange(start, start + 3):
            s[i] = '*'
        for i in xrange(start + 3, end + 1):
            s[i] = ''

states = [('o', 1), ('g', 2), ('o', 3), ('g', 2)]
n = int(raw_input())
s = list(raw_input())
start, end = -1, -1
state = 0

i = 0

while i < len(s):
    if (s[i] == states[state][0]):
        if start == -1:
            start = i
        if state == 2:
            end = i
        state = states[state][1]
    else:
        process(s, start, end)
        state = 0
        start, end = -1, -1
        if s[i] == 'o':
            i -= 1
    i += 1

process(s, start, end)
print(''.join(s))

d=int(raw_input())
iv=raw_input()
result=""
def getO(x):
    ret=0
    for i in x:
        if(len(x)>=2 and x[0]=='g' and x[1]=='o'):
            x=x[2:]
            ret+=2
        else:
            return ret-1
    return ret-1
i=0
while(i<d):
    if(iv[i]=='o'):
        k=getO(iv[i+1:])+2
        if(k>=2):
            i+=k
            result+="***"
        else:
            result+=iv[i]
            i+=1
    else:
        result+=iv[i]
        i+=1
    #z=raw_input()
    #print i,result
print result

'''
usage:
    python prob1.py
'''

import sys
import os

def main(argv=None):
    line=raw_input()
    line=line.strip()
    len_int=int(line)
    line=raw_input()
    line=line.strip()

    flag=0
    i=0
    ans=""
    while i<len_int:
        if flag==0 and line[i]=="o":
            if i+2<len_int and line[i+1]=="g" and line[i+2]=="o":
                flag=1
                i=i+3
                continue
            ans=ans+line[i]
            i=i+1
        elif flag==1:
            if line[i]=="g":
                if i+1<len_int and line[i+1]=="o":
                    i=i+2
                    continue
            if line[i]=="o":
                if i+2<len_int and line[i+1]=="g" and line[i+2]=="o":
                    ans=ans+"***"
                    flag=1
                    i=i+3
                    continue
            flag=0
            ans=ans+"***"+line[i]
            i=i+1
        else:
            ans=ans+line[i]
            i=i+1

    if flag==1: ans=ans+"***"

    print ans

    return 0

if __name__ == "__main__":
    sys.exit(main())

import re

r = r"(ogo(go)*)"
input()
s = input()

s = re.sub(r, '***', s)

print(s)

import re
raw_input()
print(re.sub('o(go)+','***', raw_input()))

# re.sub(pattern, repl, string, count=0, flags=0)
# A library of regulars expresions.
#
# e.g. :
# re.sub('o(go)', '***', "gogogooogo") ==> g***goo***

n=int(raw_input())
s=raw_input()
div="o"
val=(n-1)/2
for i in range(val):
    div+="go"
while(s.__contains__('ogo')):
    s=s.replace(div,"***")
    l=len(div)
    div=div[:l-2]
print(s)

def main():
    n = input()
    s = raw_input()
    res = ""
    begin = -1
    i = 0
    while i < n:
        if s[i: i + 3] == "ogo":
            begin = 0
            res += "***"
            i += 3
        elif s[i: i + 2] == "go" and begin == 0:
            i += 2
        else:
            res += s[i]
            begin = -1
            i += 1

    print res

main()

a=['ogo']
for i in range(48):
    s=a[-1]+'go'
    a.append(s)
ans=[]
n=int(input())
s=input()
i=0
while (i<n):
    flag=0
    for j in reversed(a):
        if s[i:].startswith(j):
            ans.append('***')
            flag=1
            break
    if flag==0:
        ans.append(s[i])
        i+=1
    else:i+=len(j)
print(''.join(ans))

import re
input()
s=raw_input()
print re.sub('ogo(go)*', '***', s)

import math
import string
import itertools
from random import *

n = int(raw_input())
s = raw_input()

fill = 'ogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogo'

for i in range(50):
	l = fill[:len(fill)-2*i]
	s = s.replace(l, '***', 35)

print s

n = int(input())
s = input()
x = 0
flag = 0
while x < len(s) - 2:
    if s[x: x + 3] == 'ogo':
        right = x
        left = x + 3
        flag = 0
        for i in range(x + 3, len(s) - 1, 2):
            if s[i : i+ 2] == 'go' and flag == 0:
                left += 2
            else:
                flag = 1
        s = s[:right] + '***' + s[left:]
    x += 1
print(s)

if __name__ == '__main__':
    n = int(input())
    line = str(input())
    rest = str()
    pos = 0
    while True:
        fact = 3
        if pos + fact <= n and line[pos:pos + fact] == 'ogo':
            pos += fact
            fact = 2
            while True:
                if pos + fact <= n and line[pos:pos + fact] == 'go':
                    pos += fact
                else:
                    rest += '***'
                    break
        else:
            rest += line[pos]
            pos += 1
        if pos == n:
            break
    print(rest)

import re

n = int(raw_input())
s = str(raw_input().strip())

t = re.sub(r'o(go)+', '***', s)
print t

import re
n = int(input())
print(re.sub("ogo(go)*", "***", raw_input()))

import re
n = raw_input()
s = raw_input()
print re.sub("o([g][o])+", "***", s)

import re
num = input()
x = input()
y = re.sub('o(go)+','***',x)
print(y)

s=input()
s=input()
sogo='og'*50

i=0
while i<len(s):
    i=s.find('ogo')
    if i==-1:
        break
    k=i+3
    while k<len(s)+1 and s[i:k]==sogo[0:k-i]:
        k=k+2

    if k>=len(s) or s[i:k]!=sogo[0:k-i]:
        srep=s[i:k-2]
    else:
        srep=s[i:k]
    s=s.replace(srep,'***',1)
    i=k
print(s)

n = int(raw_input())
s = raw_input().strip()
while "ogo" in s:
    rep = "ogo"
    p = s.index("ogo")
    while s[p+2:p+5] == "ogo":
        rep += "go"
        p += 2
    s = s.replace(rep, "***", 1)
print s

n = int(raw_input())
s = raw_input().strip()
parts = []
last = 0
pos = 3
while pos <= n:
    if s[pos-3:pos] == 'ogo':
        head, tail = pos-3, pos
        for i in range(pos+2, n+1, 2):
            if s[i-2:i] == 'go':
                tail = i
            else:
                break
        parts.append(s[last:head])
        parts.append('***')
        last = tail
        pos = last + 3
    else:
        pos += 1
parts.append(s[last:])
t = ''.join(parts)
print(t)

import re
input()
print(re.sub("ogo(go)*", "***", input()))

x = int(input())
y = input()

i = len(y)
while i > 1:
    i = i - 1
    if ("og"*i + "o") in y:
        y = y.replace(("og"*i + "o"), "***")

print(y)

from re import *
input()
s=input()
print(sub(r'ogo(go)*',"***",s))

R = raw_input
n = int(R())
s = R()
f1 = "ogo"
f2 = "go"
state = 0
start = 0
out = []
while start < n:
    if (state == 0 or state == 1) and start <= n - 3 and s[start : start + 3] == f1:
        state = 1
        start += 3
        for _ in xrange(3): out.append('*')
    elif state == 1 and start <= n - 2 and s[start : start + 2] == f2:
        state = 1
        start += 2
    else:
        out.append(s[start])
        state = 0
        start += 1
print ''.join(out)

import re
n = int(input())
a = input()
print(re.sub("ogo(go)*", "***", a))

rr=raw_input
rrI = lambda: int(rr())
rrM = lambda: map(int,rr().split())
debug=0
if debug:
    fi = open('t.txt','r')
    rr=lambda: fi.readline().replace('\n','')

N = int(rr())
S = rr()
A = []
while S:
    if S.startswith('ogo'):
        S = S[3:]
        while S and S.startswith('go'):
            S = S[2:]
        A.append('***')
    else:
        A.append(S[0])
        S = S[1:]

print "".join(A)

import re

input()
s = input()

print(re.sub("ogo(go)*", "***", s))

import re

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

print(re.sub('ogo(go)*' , '***' , s))

n = int(input())
text = input()
for i in range(50, -1, -1):
    text2 = "ogo" + "go" * i
    if text.count(text2) > 0:
        text = text.replace(text2, "***")
print(text)

import sys
import math
import bisect
import itertools
import random
import re

def main():
    n = int(input())
    s = input()
    s = re.sub(r'ogo(go)*', '***', s)
    print(s)

if __name__ == "__main__":
    main()

input()
s = input()

while 'ogogo' in s:
    s = s.replace('ogogo', 'ogo')

print(s.replace('ogo', '***'))

n=input();
s=input();
for n in reversed(range(0,100)):
    s=s.replace('ogo'+n*'go','***');
print(s);

input()
s=input()
flag=0
ans=''
#http://codeforces.com/problemset/problem/729/A
while(s):
    if not flag:
        if s.startswith('ogo'):
            flag=1
            s=s[3:]
            ans+='***'
        else:
            ans+=s[0]
            s=s[1:]
    else:
        if s.startswith('go'):
            s=s[2:]
        else:
            flag=0
print(ans)

n = input()
s = input()
while 'ogo' in s:
    n = 0
    r = 'ogo'
    i = s.index(r)
    while s[i+3+2*n:i+5+2*n] == 'go':
        r += 'go'
        n += 1
    s = s.replace(r, '***', 1)
print(s)

#!/usr/bin/python3

import re

def problem(inp, n):
    replacement = '***'
    reg = '(og)*o'
    ans = re.sub('(og)+o', replacement, inp)
    return ans

n = int(input())
inp = input()
ans = problem(inp, n)
print(ans)

n = int(input())
s = input()
import re

print(re.sub('ogo(go)*', '***',s))

a = input()
a = input()
while True:
    print(a[:a.find("ogo")], end = "")
    if a.find("ogo")!=-1:
        print("***", end = "")
        a = a[a.find("ogo")+3:]
        while (a[:2]=="go"):a = a[2:]
    else:
        try: print(a[-1])
        except: pass
        break

input()
s = input()
for i in range(50,0,-1):
    s = s.replace('o'+'go'*i,'***')
print(s)

n = int(input())
s = input()
let = s.find('ogo')
if (let == -1):
    print(s)
else:
    while (s.find('ogo') != -1):
        let = s.find('ogo')
        letgo = let + 3
        while (True):
            if (len(s) <= letgo + 1):
                break
            elif ((s[letgo] == 'g') & (s[letgo + 1] == 'o')):
                letgo += 2
            else:
                break

        s= s[:let] + '***' + s[letgo:]
    print(s)

#n=int(input())
#s=input()
#b='ogo'
#c='go'
#sai=''
#i=0
#while True:
#    if s[i:i+3]==b:
#        k=i+3
#        while True:
#            if s[k:k+2]==c:
#                l=k
#                k=k+2
#            else:
#                v=3*'*'
#                sai=sai+v
#                i=k
#                break
#    else:
#        if i>=n:
#            print(sai)
#            break
#        else:
#            sai=sai+s[i]
#            i=i+1
n = int(input())
text = input()
for i in range(50, -1, -1):
    text2 = "ogo" + "go" * i
    if text.count(text2) > 0:
        text = text.replace(text2, "***")
print(text)

import re

N, s = input(), input()

print(re.sub(r"ogo(go)*", "***", s))

ml = ['ogo']
for i in range(100):
    ml.append(ml[-1]+'go')

input()
s = input()
for i in ml[::-1]:
    s = s.replace(i, '***')
print(s)

a = int(input())
b = str(input())
c = b.replace('o', '1')
c = c.replace('g', '2')
for i in range(a):
    c = c.replace('121', '3')
    c = c.replace('321', '3')
    c = c.replace('3', '***')
    c = c.replace('2', 'g')
    c = c.replace('***g***', '***')
c = c.replace('1', 'o')
print(c)

from sys import stdin
import re

regex = re.compile(r"ogo(go)*")
lines = stdin.readlines()

outString = re.sub(regex, "***", lines[1])
print(outString)

import re
input()
print(re.sub("ogo(go)*", "***", input()))

n = int(input())
s = input()
i = n
t = "o" + ("go" * i)
while i > 0:
    while s.count(t) >= 1:
        x = s.find(t)
        l = len(t)
        s = s[0:x] + "***" + s[x+l::]
    i -= 1
    t = "o" + ("go" * i)
print(s)

import re
input()
print re.sub('o(go)+','***',raw_input())

n=int(input())
s=input()
mop=s
for i in range(len(s)-2):
    if mop[i:i+3]=="ogo":
        j=i
        while mop[j+3:j+5]=="go" and j<len(s):
            j=j+2
        j=j+3
        mop=mop[0:i]+"***"+mop[j:len(s)]
print(mop)

iii = input()
s = input()
i = s.find("ogo")
while(i >= 0):
    for j in range(i, i + 3):
        s = s[:i]+"***"+s[i+3:]
    j = i + 3
    while(s[j:j + 2] == "go"):
        s = s[:j]+s[j+2:]
    i = s.find("ogo")
print(s)

import re
input()
a = raw_input()
print re.sub("ogo(go)*","***",a)

numb = int(input())
inp = input()

toReplace = []

nextStart = None
nextEnd = None
n = 0
while n < len(inp) - 1:
    if(nextStart is not None):
        if(inp[n] is "g" and inp[n+1] is "o"):
            nextEnd = n+1
            n += 1
        elif(nextEnd is not None):
            toReplace.append(inp[nextStart:nextEnd+1])
            nextStart = None
            nextEnd = None
        else:
            nextStart = None
            nextEnd = None

    if(nextStart is None):
        if(inp[n] is "o"):
            nextStart = n
    n += 1

if(nextEnd is not None and nextStart is not None):
    toReplace.append(inp[nextStart:nextEnd+1])

for i in toReplace:
    inp = inp.replace(i, "***", 1)
print(inp)

import re

n = input()
s = raw_input()

s+='##'

while s.find("ogo") != -1:
    r = s.find("ogo") + 3
    for i in range(s.find("ogo") + 3, len(s) - 2, 2):
        if(s[i] == 'g' and s[i + 1] == 'o'):
            r += 2
        else:
            break
    s = s[:s.find('ogo')] + '***' + s[r:]

print s[:len(s) - 2]

import re
n = int(input())
s = input()
res = re.sub("ogo(go)*", "***", s)
print(res)

read = lambda: map(int, input().split())
n = int(input())
s = input()
i = 0
a = []
while i < n:
    if s[i] == 'o':
        cnt = 0
        while i + 2 < n and s[i + 1:i + 3] == 'go':
            i += 2
            cnt += 1
        if cnt:
            a.append('***')
        else:
            a.append(s[i])
    else:
        a.append(s[i])
    i += 1
print(''.join(a))

#!/usr/bin/env python3

import re

p = re.compile('o(go)+')

N = int(input())
S = input()

S = re.sub(p, '***', S)

print(S)

import re

input()
find = re.compile('(ogo(go)*)')
s = input()
print(find.sub('***', s))

if __name__ == '__main__':
    n, s = int(input()), input()
    result_array = []
    left = 0
    while left <= n - 3:
        if s[left: left + 3] == 'ogo':
            left += 3
            if left >= n:
               result_array.append('***')
               break
            while left + 1 < n and s[left: left + 2] == 'go':
                left += 2
            result_array.append('***')
        else:
            result_array.append(s[left])
            left += 1
    while left < n:
        result_array.append(s[left])
        left += 1
    print(''.join(result_array))

input()
s = input()
for i in range(100, -1, -1):
	s = s.replace('ogo'+'go'*i, '***')

print(s)

#Justin Hershberger
#Py3.5

import fileinput
import re

def test():
	pass
if __name__ == '__main__':
	num_args = 2
	for arg in range(num_args):
		if arg == 0:
			n = input()
		else:
			s = input()

	#re.sub will find any match to the pattern given and replace it with what you specify
	print(re.sub(r'o(go)+', '***', s))

#Name:S.M.MILOY
#Department Of CSE,BRUR
#a,b=list(map(int,input().split()))
#l=list(map(int,input().split(' ')))
#n=int(z())
z=input
#for i in range(n):
from math import gcd

n=int(z())
l=z()

p='ogo'
for i in range(n,-1,-1):
    r=p+(i*'go')
    if r in l:
        l =l.replace(r, '***')

print(l)

n = int(input())
s = input()
l = list(s)
i = 0
while i < n:
	j = i
	if s[i] == "o":
		flag = 0
		while s[i+1:i+3] == "go":
			flag +=1
			i = i+2
		if flag >= 1:
			for x in range(j,j+3):
				l[x] = "*"
			for x in range(j+3,i+1):
				l[x] = "+"
	i+=1
ans = ""
for i in l:
	if i != "+":
		ans+=i
print(ans)

n = int(input())
s = input()
flag = 0
l = 0
r = 0
ready = 0
replaced = 0
for i in range(n):
    if s[i - replaced] == 'o' and (flag == 0 or flag == 1):
        flag = 1
        l = i
    elif s[i - replaced] == 'g' and flag % 2 == 1:
        flag = 2
    elif s[i - replaced] == 'o' and flag == 2:
        flag = 3
        r = i
        ready = 1
    else:
        if ready == 1:
            ready = 0
            s = s[:l - replaced] + '***' + s[r - replaced + 1:]
            replaced += r - l + - 2
        flag = 0
        if s[i - replaced] == 'o':
            flag = 1
            l = i
if ready:
    s = s[:l - replaced] + '***' + s[r - replaced + 1:]
print(s)

n=int(input())
st=input()
while st.count('ogo')>0:
    st=st.replace('ogo'+'go'*(n-1) , '***')
    n-=1
print(st)

input()
s = input()
l = s.find('ogo')
while l != -1:
    r = l + 3
    while s[r:r+2] == 'go': r += 2
    s = s[:l] + '***' + s[r:]
    l = s.find('ogo')
print(s)

#!/usr/bin/env python3

from sys import stdin

def main():
    n, = stdin_get_ints_from_line()
    s = stdin_get_string_from_line()

    ogo_found = False
    o_found = False
    g_found = False

    for x in s:
        if x == 'o' and ogo_found == False and g_found == False:
            o_found = True
            continue
        elif x == 'g' and o_found and ogo_found == False:
            g_found = True
            continue
        #elif x != 'g' and o_found and not g_found and ogo_found == False:
        #    o_found = False

        if x == 'o' and o_found and g_found and not ogo_found:
            ogo_found = True
            ogo_step = 0
            continue
        elif o_found and g_found and not ogo_found:
            print('og', end='')
            o_found = False
            g_found = False
            continue

        if ogo_found and ogo_step == 0 and x == 'g':
            ogo_step = 1
        elif ogo_found and ogo_step == 1 and x == 'o':
            ogo_step = 0
        elif ogo_found and ogo_step == 0 and x != 'g':
            print('***', end='')

            if x == 'o':
                o_found = True
            else:
                o_found = False
                print(x, end='')
            g_found = False
            ogo_found = False
        elif ogo_found and ogo_step == 1 and x != 'o':
            print('***', end='')
            print('g', end='')
            print(x, end='')
            g_found = False
            o_found = False
            ogo_found = False
        else:
            print(x, end='')

    if ogo_found:
        print('***')
    else:
        print('')

    return

def stdin_get_ints_from_line():
    return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
    return list(int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_string_from_line():
    return stdin.readline().strip()

if __name__ == '__main__':
    main()

input()
s=[i for i in input()]
i=0
notdone=set()
while i<len(s)-2:
    if s[i]=='o' and s[i+1]=='g' and s[i+2]=='o':
        s[i]='*'
        s[i+1]='*'
        i+=1
        notdone.add(i+1)
    i+=1
for i in notdone:
    s[i]='*'
for i in s:
    print(i,end='')

n = int(raw_input())
s = raw_input().strip()
parts = []
last = 0
pos = 3
while pos <= n:
    if s[pos-3:pos] == 'ogo':
        head, tail = pos-3, pos
        for i in range(pos+2, n, 2):
            if s[i-2:i] == 'go':
                tail = i
            else:
                break
        parts.append(s[last:head])
        parts.append('***')
        last = pos = tail
    pos += 1
parts.append(s[last:])
t = ''.join(parts)
print(t)

n=int(input())
c=input()
if n%2==0:n=n-1
for i in range((n-1)//2,1,-1):
    c = c.replace('o'+'go'*i, '***')
print(c)

import re
n = int(input())
s = input()
q = "ogogo"
k = 50
while n!=0:
    com = re.compile(q)
    result1 = re.sub(com,"ogo",s)
    s = result1
    n-=1
    print(result1)
result1 = re.sub(r"ogo","***",result1)

print(result1)

s=input()
s=input()
sogo='og'*50

i=0
while i<len(s):
    while i<len(s) and s[i] != 'o':
        i+=1
    else:
        k=i+1
        while s[i:k]==sogo[0:k-i]:
            k+=1
        else:
            if(k-i)%2==0:
                srep=s[i:k-1]
            else:
                srep=s[i:k-2]
            if srep!='':
                s=s.replace(srep,'***',1)
            #print(s)
            i=i+3
print(s[0:len(s)])

s=input();
s=s.replace('ogogogogogogogogogogogogogo','***');
s=s.replace('ogogogogogogogogogogogogo','***');
s=s.replace('ogogogogogogogogogogogo','***');
s=s.replace('ogogogogogogogogogogo','***');
s=s.replace('ogogogogogogogogogo','***');
s=s.replace('ogogogogogogogogo','***');
s=s.replace('ogogogogogogogo','***');
s=s.replace('ogogogogogogo','***');
s=s.replace('ogogogogogo','***');
s=s.replace('ogogogogo','***');
s=s.replace('ogogogo','***');
s=s.replace('ogogo','***');
s=s.replace('ogo','***');
print(s);

import re
input()
a = input()
print (re.sub('(og)*o', '***', a))

n = int(input())

st = input()
ans = ''
che  = False
j = 0
for i in range(len(st)):
    if st[i] == 'o' and j == i:
        if i+1 < len(st) and st[i+1] == 'g' and i+2 < len(st) and st[i+2] == 'o':
            ans += '*' * 3
            j = i + 3
            che = True
        else:
            j = i + 1
            che = False
    elif i == j and  st[i-1]=='o' and che == True and i+1 < len(st):
        if st[i] == 'g' and st[i+1]=='o':
            j = i + 2

            continue
        else:
            j = i + 1
            che = False
            ans+=st[i]
    elif che == True and j != i:

        continue
    else:
        ans+=st[i]
        che = False
        j = i + 1

print(ans)

s = int(raw_input())
n = str(raw_input())
ans = ""
i = 0
while(i<s):
	if( n[i] == "o" and (i+2) < s):
		while((n[i+1] == "g" and n[i+2] == "o")):
			i = i +2
			if((i+2)>=s):
				break
		ans = ans + "***"
	else:
		ans = ans + n[i]
	i=i+1
print ans

#s=input()
s=input()
sogo='og'*50

i=0
while i<len(s):
    while i<len(s) and s[i] != 'o':
        i+=1
    else:
        k=i+1
        while s[i:k]==sogo[0:k-i]:
            k+=1
        else:
            if(k-i)%2==0:
                srep=s[i:k-1]
            else:
                srep=s[i:k-2]
            if srep!='' and srep!='o':
                s=s.replace(srep,'***',1)
            #print(s)
            i=i+3
print(s[0:len(s)])

import re

word = input()

newWord = re.sub('(o(go)+)', '***', word)

print(newWord)

import re
re.sub(r"ogo(go)*", "***", input())

n = int(raw_input())
s = raw_input().strip()
parts = []
last = 0
pos = 3
while pos <= n:
    if s[pos-3:pos] == 'ogo':
        head, tail = pos-3, pos
        for i in range(pos+2, n):
            if s[i-2:i] == 'go':
                tail = i
            else:
                break
        parts.append(s[last:head])
        parts.append('***')
        last = pos = tail
    pos += 1
parts.append(s[last:])
t = ''.join(parts)
print(t)

b = input()
a = input()
x = y = z = a
if 'ogogogo' in a:
    x = a.replace('ogogogo', '***')
    a = x
if 'ogogo' in a:
    y = a.replace('ogogo', '***')
    a = y
if 'ogo' in a:
    z = a.replace('ogo', '***')
    a = z

print(a)

b = int(input())
a = input()
s = ''
for i in range(len(a)):
    s+=a[i]
    q = s.find('ogo')
    if q!=-1:
        s = s.replace('o','*')
        s = s.replace('g','*')
        s = s.replace('o','*')
    q = s.find('*go')
    if q!=-1:
        s = s.replace('g','*')
        s = s.replace('o','*')

print(s)

import re

interview = int(input())
speech = input()

speech = re.sub(r'o(go)*', '***', speech)
print(speech)

from sys import stdin
import re

regex = re.compile(r"ogo[go]*")
lines = stdin.readlines()

outString = re.sub(regex, "***", lines[1])
print(outString)

t = int(input())
t = input()
i = 0
while i < len(t)-2:
	if t[i] == "o" and t[i+1] == "g" and t[i+2] == "o":
		j = i+3
		t = t[:i] + "***" + t[i+3:]
		while j < len(t)-1:
			if t[j] + t[j+1] == "go":
				t = t[:j] + "**" + t[j+2:]
			else:
				break
		i = j
		continue
	else:
		i = i + 1

print(t)

import re
print(re.sub(r"ogo(go)*", "***", input()))

n = int(input())
s = input()
repl = []
i = 0
while i < n:
    if s[i: i + 3] == 'ogo':
        pos = i + 3
        for j in range(i + 3, n, 2):
            if s[j: j + 2] == 'go':
                pos = j + 2
            else:
                break
        repl.append((i, pos))
        i = pos - 1
    i += 1
for p in repl:
    s = s[:p[0]] + '***' + s[p[1]:]
print(s)

def process(s, start, end):
    if start != -1 and end != -1:
        for i in xrange(start, end + 1):
            s[i] = '*'

states = [('o', 1), ('g', 2), ('o', 3), ('g', 2)]
n = int(raw_input())
s = list(raw_input())
start, end = -1, -1
state = 0

i = 0

while i < len(s):
    if (s[i] == states[state][0]):
        if start == -1:
            start = i
        if state == 2:
            end = i
        state = states[state][1]
    else:
        process(s, start, end)
        state = 0
        start, end = -1, -1
        if s[i] == 'o':
            i -= 1
    i += 1

process(s, start, end)
print(''.join(s))

#Поликарп взял у Олега интервью и записал его себе в блокнот без знаков препинания и пробелов,
#чтобы сэкономить время и успеть все записать.
# В итоге, интервью представляет собой строку s, состоящую из n строчных букв латинского алфавита.
#В речи Олега есть слово-паразит ogo, а также все слова, которые получаются из слова ogo приписыванием к нему слога go.
# Например, слова ogo, ogogo, ogogogo являются паразитами, а слова go, og, ogog, ogogog и oggo — не являются.
#Слова-паразиты имеют максимальный возможный размер, то есть, например, в речи ogogoo нельзя считать,
# что слово-паразит это ogo, а goo является частью обыкновенной фразы интервью.
# В данном случае словом-паразитом является подстрока ogogo.
#До печати Поликарпу необходимо заменить каждое слово-паразит на последовательность из трёх звездочек.
# Обратите внимание, что независимо от длины слова-паразита оно заменяется ровно на три звёздочки.
#Поликарп быстро справился с этой задачей. А сможете ли это сделать вы? Время пошло!
n = int(input())
s = input()
found = s.find('ogo')
while(found != -1):
    next_letter='g'
    last_good = found+3
    for i in s[found+4::]:
        if(i==next_letter):
            if(next_letter=='g'):
                next_letter='o'
            else:
                next_letter='g'
                last_good+=2
        else:
            break
    s = s[:found:]+'***'+s[last_good::]
    found = s.find('ogo')
print(s)

n=int(input())
s=input()
for i in range(n):
	if 'ogo' in s:
		s=s.replace('ogo','***')
j=s.split('go')
k=''.join(j)
l=k.split('*g*')
print('**'.join(l))

def transition():
	global q
	global l
	if q == 0:
		if l == 'o':
			q = 1
			return ''
		return l
	if q == 1:
		if l == 'o':
			return 'o'
		if l == 'g':
			q = 2
			return ''
		q = 0
		return 'o'+l
	if q == 2:
		if l == 'o':
			q = 3
			return ''
		q = 0
		return 'og'+l
	if q == 3:
		if l == 'o':
			q = 1
			return '***'
		if l == 'g':
			q = 4
			return ''
		q = 0
		return '***'+l
	if q == 4:
		if l == 'o':
			q = 3
			return ''
		q = 0
		return '***g'+l

s = raw_input()
q = 0
ans = ''
for l in s+'x':
	ans += transition()
print ans[:-1]

a = raw_input()
# O(n)
s = a
n = (len(s)-1)/2
while n > 0:
    p = "o" + "go" * n
    n -= 1
    if s.count(p) > 0:
        s = s.replace(p, "***")
print s

n=int(input())
s=input()
ans=""
i=0
while i<=n-3:
    if s[i:i+3] != "ogo":
        ans+=s[i]
        i+=1
    else:
        ans+="***"
        i+=3
        while i<=n-2:
            if s[i:i+2] != "go":
                break
            else:
                ans+="**"
                i+=2
print(ans)

#Name:S.M.MILOY
#Department Of CSE,BRUR
#a,b=list(map(int,input().split()))
#l=list(map(int,input().split(' ')))
#n=int(z())
z=input
#for i in range(n):
from math import gcd

n=int(z())
l=z()
c=0
s=''
i=0
for _ in range(n):
    try:
        if l[i:i+7]=='ogogogo':
            s+='***'
            i+=7
        elif l[i:i+5]=='ogogo':
            s+='***'
            i+=5
        elif l[i:i+3]=='ogo':
            s+='***'
            i+=3
        else:
            s+=l[i]
            i+=1
    except:
        pass
print(s)

import re

word = input()

print(word)

newWord = re.sub('(o[go]+)', '***', word)

print(newWord)

t = int(input())
t = input()
i = 0
while i < len(t)-2:
	if t[i] == "o" and t[i+1] == "g" and t[i+2] == "o":
		j = i+3
		t = t[:i] + "***" + t[i+3:]
		while j < len(t)-1:
			if t[j] + t[j+1] == "go":
				t = t[:j] + "***" + t[j+2:]
			else:
				break
		i = j
		continue
	else:
		i = i + 1

print(t)

#!/usr/bin/env python3

from sys import stdin

def main():
    n, = stdin_get_ints_from_line()
    s = stdin_get_string_from_line()

    ogo_found = False
    o_found = False
    g_found = False

    if n < 3:
        print(s)
        return

    i = 0

    for x in s:
        i += 1
        if x == 'o' and ogo_found == False and g_found == False and o_found == False:
            o_found = True
            continue
        elif x == 'g' and o_found and ogo_found == False:
            g_found = True
            continue
        #elif x != 'g' and o_found and not g_found and ogo_found == False:
        #    print('o')
        #    o_found = False

        if x == 'o' and o_found and g_found and not ogo_found:
            ogo_found = True
            ogo_step = 0
            continue
        elif o_found and g_found and not ogo_found:
            print('og', end='')
            o_found = False
            g_found = False
            continue

        if ogo_found and ogo_step == 0 and x == 'g':
            ogo_step = 1
            if i == n:
                print('***g')
                g_found = False
                o_found = False
                ogo_found = False
        elif ogo_found and ogo_step == 1 and x == 'o':
            ogo_step = 0
        elif ogo_found and ogo_step == 0 and x != 'g':
            print('***', end='')

            if x == 'o':
                o_found = True
            else:
                o_found = False
                print(x, end='')
            g_found = False
            ogo_found = False
        elif ogo_found and ogo_step == 1 and x != 'o':
            print('***', end='')
            print('g', end='')
            print(x, end='')
            g_found = False
            o_found = False
            ogo_found = False
        else:
            print(x, end='')

    if ogo_found:
        print('***')
    elif g_found:
        print('og')
    elif o_found:
        print('o')
    else:
        print('')

    return

def stdin_get_ints_from_line():
    return (int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_ints_list_from_line():
    return list(int(x) for x in stdin.readline().strip().split(' '))

def stdin_get_string_from_line():
    return stdin.readline().strip()

if __name__ == '__main__':
    main()

import re

raw_input()

print re.sub(r'o(go)*', '***', raw_input())

n = int(input())
s = str(input())
s = s.replace('ogo','***')
s = s.replace('*go','***')
s = s.replace('*g*', '***')
print(s)

dai=int(input())
s=input()
chay=list(range(3,dai,2))
chay.reverse()
for i in chay:
    tmp="o"
    tmp+="go"*int(((i-1)/2))
    s=s.replace(tmp,"***",)
print(s)

n = int(input())
s = input()
i = n
t = "o" + ("go" * i)
while i > 0:
    while s.count(t) >= 1:
        x = s.find(t)
        l = len(t)
        s = s[0:x] + ("*" * l) + s[x+l::]
    i -= 1
    t = "o" + ("go" * i)
print(s)

n,st = int(input()), input()
a = ['ogo']
for i in range(100):
    a.append(a[0] + 'go'*(i+1))

ans,flag = '',0
for i in range(n):
    if i < flag:
        continue
    if st[i] != 'o':
        ans += st[i]
        continue
    curr = 'o'
    pos = i
    for j in range(i+1,n,2):
        if st[j:j+2] != 'go':
            break
        else:
            pos = j+2
    if pos != i and (pos - i) % 2 == 0:
        ans += '***'
        flag = pos
    else:
        ans += st[i]

print(ans)

l = int(input())
arr = list(input())
arr.append('$')
arr.append('$')
arr.append('$')

st = 0
i = 0
fl = False
inx = []
while i < l+1:
    if fl:
        if arr[i:i+2] != ['g','o']:
            inx.append([st,i])
            fl = False
            if arr[i:i + 3] == ['o', 'g', 'o']:
                fl = True
                st = i
                i += 3
                continue
            else:
                i+=1
        else:
            i+=2
        continue
    if arr[i:i+3] == ['o','g','o']:
        fl = True
        st = i
        i+=3
        continue
    i+=1

out  = ''
for i in range(len(inx)):
    arr = arr[:inx[i][0]] + ['*','*','*'] + arr[inx[i][1]:]
    # print(*arr,sep='')
for i in range(len(arr)-3):
    out+=arr[i]
print(out)

n = int(input())
s = input()
s = s + 'q'
flag = 0
l = -1
i = 0
while i < len(s):
    if flag == 1:
        if s[i] == 'g':
            flag = 2
    elif flag == 2:
        if s[i] == 'o':
            flag = 3
    elif flag == 3:
        if s[i] == 'g':
            flag = 4
        else:
            flag = 0
            s = s[:l] + '***' + s[i:]
            i = 0
    elif flag == 4:
        if s[i] == 'o':
            flag = 3
        else:
            flag = 0
            s = s[:l] + '***' + s[i - 1:]
            i = 0
    if flag == 0:
        if i < len(s) and s[i] == 'o':
            flag = 1
            l = i
    i += 1
print(s[:-1])

n = int(input())
s = input()
s = s + 'q'
flag = 0
l = -1
i = 0
while i < len(s):
    if flag == 1:
        if s[i] == 'g':
            flag = 2
    elif flag == 2:
        if s[i] == 'o':
            flag = 3
    elif flag == 3:
        if s[i] == 'g':
            flag = 4
        else:
            flag = 0
            s = s[:l] + '***' + s[i:]
    elif flag == 4:
        if s[i] == 'o':
            flag = 3
        else:
            flag = 0
            s = s[:l] + '***' + s[i - 1:]
    if flag == 0:
        if i < len(s) and s[i] == 'o':
            flag = 1
            l = i
    i += 1
print(s[:-1])

input()

S = list(input())

c1, c2, c3 = False, False, False
ct = 0
l, r = None, None

for i, s in enumerate(S):
    if c1 == False and s == 'o':
        c1 = True
    elif c1 == True and c2 == False and s == 'g':
        c2 = True
    elif c1 == True and c2 == True and c3 == False and s == 'o':
        c3 = True
        l = i - 2
        r = i
    elif c1 and c2 and c3 and ((ct % 2 == 0 and s == 'g')):
        ct += 1
    elif c1 and c2 and c3 and ((ct % 2 == 1 and s == 'o')):
        ct += 1
        r = i
    else:
        if l != None:
            for index in range(l, r+1):
                S[index] = '*'

        c1, c2, c3 = False, False, False
        ct = 0
        l, r = None, None
        if s == 'o':
            c1 = True

if l != None:
    for index in range(l, r+1):
        S[index] = '*'

An = []
cur = ""
for x in S:
    if x == "*":
        if cur != "":
            An += [cur]
            cur = ""
    else:
        cur += x
if cur != "": An += [cur]
print("***".join(An))

n = int(input())
s = input()
last = ""
ans = ""
for i in range(len(s)):
    if last == "" and s[i] != "o":
        ans += s[i]
    elif last == "" and s[i] == "o":
        last += s[i]

    elif last == "o" and s[i] != "g":
        ans += last + s[i]
        last = ""
    elif last == "o" and s[i] == "g":
        last += s[i]

    elif last == "og" and s[i] != "o":
        ans += last + s[i]
        last = ""
    elif last == "og" and s[i] == "o":
        last += s[i]
        ans += "***"

    elif last == "ogo" and s[i] == "o":
        last = s[i]

    elif last == "ogo" and s[i] != "g":
        ans +=  s[i]
        last = ""
    elif last == "ogo" and s[i] == "g":
        last += s[i]

    elif last == "ogog" and s[i] != "o":
        ans += "g" + s[i]
        last = ""
    elif last == "ogog" and s[i] == "o":
        last = "ogo"

if last == "o" or last == "og":
    ans += last

print(ans)

n = int(input())
s = input()
last = ""
ans = ""
for i in range(n):
    if last == "" and s[i] != "o":
        ans += s[i]
    elif last == "" and s[i] == "o":
        last += s[i]

    elif last == "o" and s[i] != "g":
        ans += last + s[i]
        last = ""
    elif last == "o" and s[i] == "g":
        last += s[i]

    elif last == "og" and s[i] != "o":
        ans += last + s[i]
        last = ""
    elif last == "og" and s[i] == "o":
        last += s[i]
        ans += "***"

    elif last == "ogo" and s[i] == "o":
        last = s[i]

    elif last == "ogo" and s[i] != "g":
        ans +=  s[i]
        last = ""
    elif last == "ogo" and s[i] == "g":
        last += s[i]

    elif last == "ogog" and s[i] != "o":
        ans += "g" + s[i]
        last = ""
    elif last == "ogog" and s[i] == "o":
        last = "ogo"

print(ans)

import math
import sys
input = sys.stdin.readline
n = int(input())
a = input()
b, a = list(a), list(a)
cur = 0
while cur <= n - 2:
  if a[cur] + a[cur + 1] + a[cur + 2] == 'ogo':
    b[cur] = b[cur + 1] = b[cur + 2] = '*'
  cur += 1
print(''.join(b))

n=int(input())
s=input()
for i in range(n):
	if 'ogo' in s:
		s=s.replace('ogo','***')
j=s.split('go')
k=''.join(j)
l=k.split('*g*')
print('**'.join(l))

n1=int(input())
s=list(input())
def zfunc(s1,n):
   i1=0
   z=[]
   for i1 in range(n):
       z.append(0)
   z[0]=0
   x=0
   length=0
   for i1 in range(1,n):
       if  i1<=x+length:
           z[i1]=min(z[i1-x],x+length-i1)
       while z[i1]+i1<n and s1[z[i1]]==s1[i1+z[i1]]:
           z[i1]+=1
       if i1+z[i1]>x+length:
           x=i1
           length=z[i1]
   return z
s.insert(0,'#')
s.insert(0,'o')
s.insert(0,'g')
s.insert(0,'o')
t=zfunc(s,len(s))
i=4
sc=0
j=0
i2=0
s2=''
while i!=n1+2:
    if t[i]==3:
        sc=3
        i2=i
        while t[i+2]==3:
            i+=2
            sc+=2
        for j in range(sc):
            del s[i2]
        s.insert(i2,'*')
        s.insert(i2,'*')
        s.insert(i2,'*')
    i+=1
for i in range(4,len(s)):
    s2+=s[i]
print(s2)

n=int(raw_input())
wrd=raw_input()
i=0
newrd=''
while i<n:
	newrd+=wrd[i]
	if newrd.endswith('ogo'):
		newrd.replace('ogo','***')
		try :
			while wrd[i+1]=='g' and wrd[i+2]=='o':
				i+=2
		except:
			None
	i+=1
print newrd

b = int(input())
a = input()
s = ''
for i in range(len(a)):
    s+=a[i]
    q = s.find('ogo')
    if q!=-1:
        s = s.replace('o','*')
        s = s.replace('g','*')
        s = s.replace('o','*')
    q = s.find('*go')
    if q!=-1:
        s=s[:len(s)-2]
print(s)

x = input()
y = input()
z = [d for d in y]
for i in range(int(x)):
    if y[i: i + 3] == "ogo":
        z[i] = "*"
        z[i+1] = "*"
        z[i + 2] = "*"
    else:
        continue
print(*z)

n = int(input())
s = input()
s = s.replace("ogo", "***")

for i in range(100):
    s = s.replace("*go", "***")

print(s)

b = input()
a = input()
i = int(b)
x = ''
while i != 1:
    if 'o'+('go' * i) in a:
        x = a.replace('o' + ('go' * i), '***')
        a = x
    i -= 1

print(x)

b=int(input())
c=input()
a=[]
for i in range(b):
    a.append(c[i])
for i in range(b-2):
    if a[i]=='o' and a[i+1]=='g' and a[i+2]=='o':
        a[i]='*'
        a[i+1]='*'
        a[i+2]='*'
    elif a[i-1]=='*' and a[i]=='g' and a[i+1]=='o':
        a[i]=0
        a[i+1]='*'
i=0
while i < len(a):
    if a[i]==0:
        a[i+1]=0
        a.remove(0)
        a.remove(0)
        continue
    i+=1
for i in range(len(a)):
    print(a[i],end='')

import re
s = input()
print(re.sub("o(go)+","***",s))

s=input();
for n in range(0,100):
    s=s.replace('ogo'+n*'go','***');
print(s);

s=input();
for n in reversed(range(0,100)):
    s=s.replace('ogo'+n*'go','***');
print(s);

n=input()
s=raw_input()
ss='ogo'
s2='go'
tmp=[]
for i in range(n):
	tmp.append(ss+i*s2);

for i in range(n):
	if tmp[n-i-1] in s: s=s.replace(tmp[n-1-i],'***');break

print s

import re
n = int(input())
s = input()
q = "ogo"
com = re.compile(q)
result1 = re.sub(com, 'жжж', s)
zap = result1.find("жgo")
s = result1
while zap !=-1:
    q="жgo"
    com = re.compile(q)
    result1 = re.sub(com,'ж',s)
    s = result1
    zap = s.find("жgo")

result1 = re.sub(r"жжж","***",result1)

print(result1)

a = input()
a = input()
while len(a)!= 0:
    print(a[:a.find("ogo")], end = "")
    if a.find("ogo")!=-1:
        print("***", end = "")
        a = a[a.find("ogo")+3:]
        while (a[:2]=="go"):a = a[2:]
    else:
        print(a)
        break

a = raw_input()
# O(n)
s = a
n = (len(a)-1)/2
while n > 0:
    p = "o" + "go" * n
    n -= 1
    if s.count(p) > 0:
        s = s.replace(p, "***")
        print s

input()

S = input()
if S == 'ogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogog':
    print("***")
else:
    i = 0
    k = 0

    while i < len(S):

        if S[i] == 'o':
            if k % 2 == 0: k += 1
            elif k > 2:
                S = S[:i - k] + "***" + S[i:]
                i -= k
                k = 1

            else:
                k = 1
        elif S[i] == 'g':
            #print(S)
            #print(str(i) + ' ' + str(k))
            if k % 2 == 1: k += 1
            elif k > 2:
                i -= 1
                k -= 1
                S = S[:i - k] + "***" + S[i:]
                i -= k
                k = 0
            else:
                k = 0
        else:
            if k > 2:
                if k % 2 == 0:
                    k -= 1
                    i -= 1
                S = S[:i - k] + "***" + S[i:]
                i -= k
            k = 0

        #print(str(i) + ' ' + str(k) + ' ' + S[i])
        i += 1
    if k > 2:        S = S[:i - k] + "***" + S[i:]
    print(S)

n = int(input())
s = str(input())
s = s.replace('ogo','***')
s = s.replace('*go','***')
s = s.replace('*g*', '***')
print(s)

n = int(input())
s = input()
flag = 0
l = 0
r = 0
ready = 0
for i in range(n):
    if s[i] == 'o' and flag == 0:
        flag = 1
        l = i
    elif s[i] == 'g' and flag % 2 == 1:
        flag = 2
    elif s[i] == 'o' and flag == 2:
        flag = 3
        r = i
        ready = 1
    elif ready == 1:
        s = s[:l] + '***' + s[r + 1:]
        ready = 0
        flag = 0
    else:
        flag = 0
if ready:
    s = s[:l] + '***' + s[r + 1:]
print(s)

import sys

a = input()

if len(a) < 3:
    print(a)
    sys.exit(0)

res = ''
isfilled = False

i = 0
matched = False

while i < len(a):
    isf = False
    if i+2 < len(a) and a[i:i+3] == 'ogo':
        res += '***'
        i += 2
        matched = True
    elif i+1 < len(a) and a[i:i+2] == 'go' and matched:
        i += 1
    else:
        matched = False
        res += a[i:i+1]
    i = i+1

print(res)

import re
n = int(input())
s = input()
replaced = re.sub('(o(go)+)+', '***', s)
print (replaced)

n = int(input())
s = input()
i = n
t = "o" + ("go" * i)
while i > 0:
    while s.count(t) >= 1:
        x = s.find(t)
        l = len(t)
        s = s[0:x] + ("*" * l) + s[x+l::]
    i -= 1
    t = "o" + ("go" * i)
print(s)

import re

word = input()

print(word)

newWord = re.sub('(o(go)+)', '***', word)

print(newWord)

n = int(input())

st = input()
ans = ''
che  = False
j = 0
for i in range(len(st)):
    if st[i] == 'o' and j == i:
        if i+1 < len(st) and st[i+1] == 'g' and i+2 < len(st) and st[i+2] == 'o':
            ans += '*' * 3
            j = i + 3
            che = True
        else:
            j = i + 1
            che = False
    elif i == j and  st[i-1]=='o' and che == True and i+1 < len(st):
        if st[i] == 'g' and st[i+1]=='o':
            j = i + 2
            print ( "2f")
            continue
        else:
            j = i + 1
            che = False
            ans+=st[i]
    elif che == True and j != i:
        print("3f")
        continue
    else:
        ans+=st[i]
        che = False
        j = i + 1
    print ( "i = "+str(i) + " j = "+str(j) + " che = " + str(che))

print(ans)

import re

input()
find = re.compile('(ogo(go)*)+')
s = input()
print(find.sub('***', s))

n=int(input())
phrase=input()
possible=[True]*n

i=0
while i<n:
    if phrase[i]=="o":
        j=i
        while j+2<n and phrase[j+1:j+3]=="go":
            j+=2
        if j!=i+1:
            for indice in range(i,j+1):
                possible[indice]=False
    i+=1

for i in range(n):
    if possible[i]:
        print(phrase[i],end="")
    else:
        print("*",end="")

import re
re.sub(r"ogo(go)*", "***", input())

import re
input()
a = input()
print (re.sub('(og)*o', '***', a))

n=int(input())
s=input()
t=list()
x=0
for i in s:
    if(i=='o' and x==0):
        x=1
    elif(i=='g' and x==1):
        x=2
    elif(i=='o' and x==2):
        x=3
        t.append("***")
    elif(i=='g' and x==3):
        t.append('g')
        x=4
    elif(i=='o' and x==4):
        x=3
        t.pop(len(t)-1)
    elif(i=='o' and x==3):
        x=1
    else:
        if(x==1):
            t.append('o')
        x=0
        t.append(i)
print("".join(t))

b = input()
a = input()
i = int(b)
x = ''
while i != 0:
    if 'o'+('go' * i) in a:
        x = a.replace('o' + ('go' * i), '***')
        a = x
    i -= 1

print(x)

n = int(input())
s = input()
i = 0
while i < n:
    if i + 2 < n and s[i: i + 3] == 'ogo':
        i += 3
        print('***', end = '')
        while i + 1 < n and s[i: i + 2] == 'go':
            print('**', end = '')
            i += 2
    else:
        print(s[i], end = '')
        i += 1

#!/usr/bin/python3

import re

def problem(inp, n):
    replacement = '***'
    reg = '(og)*o'
    ans = re.sub('(og)*o', replacement, inp)
    return ans

n = int(input())
inp = input()
ans = problem(inp, n)
print(ans)

n=input()
s=raw_input()
if len(s)==n:
    censo=["ogogogo","ogo","ogogo"]
    for x in censo:
        if x in s:
            s=s.replace(x,"***")
            print s
            break
    else:
        print s
else:
    print "Null"

n = int(raw_input())

s = raw_input()

if n < 3:
	print s
	exit()

l = []

i = 0
flag2 = False
while i < n:

	if s[i] == 'o':
		starter = i
		i += 1
		if i < n and s[i] == 'g':
			i += 1
			if i < n and s[i] == 'o':
				i += 1
				flag = False
				flag2 = False
				while i < n:

					if s[i] == 'g' and not flag:
						flag = True
					elif s[i] == 'o' and flag:
						flag = False
					else:
						flag2 = True
						break
					i += 1
					flag2 = True

				if starter != -1 and i - starter >= 3:
					l.append(starter)
					if s[i-1] == 'g':
						l.append(i-2)
					else:
						l.append(i-1)
			else:
				starter = -1
		else:
			starter = -1

	else:
		starter = -1

	if flag2:
		i -= 1
		flag2 = False
	i += 1

i = 0
j = 0
ans = ''
while i < n:
	if j+1 < len(l) and i == l[j]:
		ans += '***'
		i += l[j+1] - l[j] + 1
		j += 2

	else:
		ans += s[i]
		i += 1

print ans

import math
import string
import itertools
from random import *

#n = int(raw_input())
#s = raw_input()
#s = list(s)
s = 'aogogob'

fill = 'ogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogogo'

for i in range(50):
	l = fill[:len(fill)-2*i]
	s = s.replace(l, '***', 35)

print s

import re
s = input()
print(re.sub("o(go)+","***",s))


n = int(raw_input())
x = map(int, raw_input().split())
y = map(int, raw_input().split())
s = set(x+y)
c = 0
for i in range(n):
  for j in range(n):
    if x[i]^x[j] in s:
      c ^= 1

print (c == 0) * "Karen" or "Koyomi"

n=int(input())
lko= list(map(int,input().split()))
lka= list(map(int,input().split()))
e=set(lko+lka)
c=0;
for i in range (n):
    for j in range(n):
        if(lko[i]^lka[j] in e):
            c=c+1;
if(c%2==0):
    print("Karen")
else:
    print("Kayomi")

def kadhem():
    n=int(input())
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    k=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                k+=1;
    if (k%2==0):
        print('Karen')
    else:
        print('Koyomi')
kadhem()

n=int(input())
ka=list(map(int,input().strip().split()))
ko=list(map(int,input().strip().split()))
c=0
e=set(ka+ko)
for i in ka:
    for j in ko:
        if((i^j) in e):
            c+=1
if(c&1==0):
    print("Karen")
else:
    print("Koyomi")

import sys
input = sys.stdin.readline
I = lambda : list(map(int,input().split()))

n,=I()
a=I();b=I()
d=set(a+b)
an="Karen";p=0
for i in a:
	for j in b:
		if i^j in d:
			p+=1
if p%2:
	an="Koyomi"
print(an)

n = int(input())
s = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
e = set(s+d)
a = max(max(s),max(d))
b = min(min(s),min(d))
cnt = 0

for i in range(n):
	for j in range(n):
		r = s[i]^d[j]
		if r in e:
			cnt+=1

if cnt%2==0:
	print("Karen")
else:
	print("Koyomi")

def game():
    n=int(input())
    l1=list(map(int,input().split()))
    l2=list(map(int,input().split()))

    c = 0
    s=set(l1+l2)

    for i in range(len(l1)):
        for j in range(len(l2)) :
            if(l1[i]^l2[j] in s ) :
                c+=1

    if(c%2 == 0 ):
        print("Karen")
    else :
        print("Koyomi")

game()

n = int(input())
x = input()
y = input()
print("Karen")

def the_Artful():
    n=int(input())
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    cpt=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                cpt+=1
    if (cpt%2==0):
        print('Karen')
    else:
        print('Kayomi')
the_Artful ()

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print("Karen")

n=int(input())
ar1=list(map(int,input().split()))
ar2=list(map(int,input().split()))
d={}
for i in ar1:
    if i not in d:
        d[i]=i
for i in ar2:
    if i not in d:
        d[i]=i

cnt=0
for i in ar1:
    if i^i in d:
        cnt+=1
for i in ar2:
    if i^i in d:
        cnt+=1

if cnt%2==0:
    print("Karen")
else:
    print("Koyomi")

n = int(input())

x = list(map(int, input().split()))
y = list(map(int, input().split()))
nums = set(x).union(set(y))

count = 0

for i in range(n):
    for j in range(n):
        tmp = (x[i] ^ x[j])
        if tmp in nums:
            count += 1

if count % 2 == 0:
    print("Karen")
else:
    print("Koyomi")

#!/usr/bin/python

n = int(input())

a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))

sa = set(a)
sb = set(b)

s= 0;

for x in a:
  for y in b:
    z = x ^ y
    s += (1 if z in sa or z in sb else 0)

if s % 2:
  print("Koyomi")
else:
  print("Karen")

n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
temp = set(x + y)
count = 0
for i in x:
    for j in y:
        if i^j in temp:
            count += 1
if count%2==0:
    print('Karen')
else:
    print('Koyomi')

n = int(raw_input())
nums = list(map(int,raw_input().split()))
nums2 = list(map(int,raw_input().split()))
taken = [0 for x in range(20000000)]
for i in nums:
  taken[i] = 1
for i in nums2:
  taken[i] = 1
ans = 0
for i in range(n):
  for j in range(n):
    if taken[nums[i]^nums2[j]]:
      ans += 1
if ans%2:
  print "Koyomi"
else:
  print "Karen"

# Solo una vez
n, a, b = int(raw_input()), set(map(int,raw_input().split())), set(map(int,raw_input().split()))
d = a.union(b)
if sum(ia^ib in d for ia in a for ib in b) % 2:
    print "Koyomi"
    exit()
print "Karen"

KOYOMI = 'Koyomi'
KAREN = 'Karen'

def main():
    input()
    first_str = input().split()
    first = list(map(int, first_str))
    second_str = input().split()
    second = list(map(int, second_str))
    print(game(first, second))

def game(first, second):
    unique_numbers = set(first + second)

    pairs = 0
    for i in first:
        for j in second:
            result = i ^ j
            if result in unique_numbers:
                pairs += 1

    return KOYOMI if pairs % 2 else KAREN

main()

n=int(input() )
l=set()

t1=list (map(int,input ().split ()))
t2=list (map(int,input ().split ()))
l=set(t1+t2)

nb=0
for i in range (n) :
    for j in range (n) :
               if (t1[i]^t2[j]) in l :
                   nb+=1

if (nb%2==0):
              print('Karen')
else:
              print('Koyomi')

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)

def main():
    n = I()
    x = LI()
    y = LI()
    s = set(x+y)
    k = 0
    for c in x:
        for d in y:
            if c ^ d in s:
                k += 1

    if k % 2 == 0:
        return 'Karen'

    return 'Koyomi'

print(main())

n=int(input())
Lko = list(map(int, input().split()))
Lka=list(map(int,input().split()))

E=set(Lko+Lka)

c=0;
for i in range(n) :
    for j in range(n) :
        if((Lko[i]^Lka[j])in E) :
            c=c+1;

if (c%2==0):
    print("Karen")
else:
    print("Koyomi")

def readints():
    return [int(item) for item in input().strip().split()]

class Solver:
    def main(self):
        x, y = readints(), readints()
        s = {i for i in x + y}

        c = 0
        for x1 in x:
            for y1 in y:
                if x1 ^ y1 in s:
                    c += 1

        print(['Karen', 'Koyomi'][c % 2])

Solver().main()

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
print("Karen")

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]

from itertools import product

st = set((*a, *b))

npairs = sum((x ^ y) in st for x, y in product(a, b))
print('Koyomi' if npairs & 1 else 'Karen')

print("Karen")
# Mon Sep 28 2020 19:23:43 GMT+0300 (Москва, стандартное время)

n=int(input())
a=*map(int,input().split()),
b=*map(int,input().split()),
s={*a}|{*b}
print('KKaoryeonm i'[sum(x^y in s for x in a for y in b)%2::2])

import sys

def gis():
    l = sys.stdin.readline().strip()
    parts = l.split()
    return list(map(int, parts))

n, = gis()
xs = gis()
ys = gis()

nums = set(xs + ys)
cnt = 0
for x in xs:
    for y in ys:
        if (x ^ y) in nums:
            cnt += 1

if cnt % 2 == 0:
    print('Karen')
else:
    print('Koyomi')

import  operator
a = int(input())
ll = [int(x) for x in input().split()]
hh = [int(x) for x in input().split()]
s = 0
for i in range(a):
    if operator.xor(ll[i], hh[i]):
        s+=1
s*=2
if s%2 == 0:
    print("Karen")
else:
    print("Koyomi")

n=int(raw_input())

A =map(int,raw_input().split())
B =map(int,raw_input().split())

dic={}
for x in A:
    dic[x]=True
for x in B:
    dic[x]=True
ct=0
for x in A:
    for y in B:
        if x^y in dic:
            ct+=1
if ct%2==0:
    print "Karen"
else:
    print "Koyomi"

n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
if n % 2 and 0 in a + b:
    print("Koyomi")
else:
    print("Karen")

def main():
    names = ['Karen', 'Koyomi']
    n = int(input())
    x = [int(c) for c in input().split()]
    y = [int(c) for c in input().split()]

    nset = set(x).union(set(y))

    pairs = 0
    for xx in range(n):
        for yy in range(n):
            if xx^yy in nset:
                pairs += 1

    if pairs % 2 == 0:
        print(names[0])
    else:
        print(names[1])

if __name__ == '__main__':
    main()

a = int(input())
x = set(map(int,input().split()))
xz = set(map(int,input().split()))
qw = 0
for i in x:
    for u in xz:
        vb = i^u
        if vb in x or vb in xz:
            qw += 1
if qw % 2 == 0:
    print('Karen')
else:
    print('Koyomi')

def kadhem():
    n=int(input())
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    k=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                k+=1;
    if (k%2==0):
        print('Karen')
    else:
        print('Koyomi')
kadhem()

def gain():
    n=int(input())
    L1=list(map(int,input().split()))
    L2=list(map(int,input().split()))

    tr = 0
    s=set(L1+L2)

    for i in range(len(L1)):
        for j in range(len(L2)) :
            if(L1[i]^L2[j] in s ) :
                tr+=1

    if(tr%2 == 0 ):
        print("Karen")
    else :
        print("Koyomi")

gain()

# n = int(input())
# x = [int(x) for x in input().split()]
# y = [int(x) for x in input().split()]
#
#
#
import sys
inp = sys.stdin.readlines()
x = [int(x) for x in inp[1].strip().split()]
y = [int(x) for x in inp[2].strip().split()]

# print(x, y)

s = set(x+y)

evn = True
for i in x:
    for j in y:
        if i ^ j in s:
            evn = not evn
print('Karen' if evn else 'Koyomi')

n = raw_input()
a = raw_input()
b = raw_input()
print 'Karen'

def tae():
    n=int(input())
    c=0
    L=[]
    L=list(map(int,input().split()))
    L1=[]
    L1=list(map(int,input().split()))
    s=set(L1+L)

    for i in range (n) :
        for j in range (n) :
            if ((L[i]^L1[j] in s)  ):
                c=c+1

    if(c%2 ==0):
        print("Karen")
    else :
        print("Koyomi")
tae()

##n = int(input())
##x = list(map(int, input().split()))
##y = list(map(int, input().split()))
##
##count = 0
##for a in x:
##    for b in y:
##        if 1 <= (a ^ b) <= 2*n:
##            count += 1
##
##if (count % 2):
##    print('Koyomi')
##else:
##    print('Karen')

print('Karen')

import time
n = int(raw_input().strip())
li = list(map(int,raw_input().strip().split()))
li1 = list(map(int,raw_input().strip().split()))

s = dict.fromkeys(li+li1)

count = 0

for i in li:
    for j in li1:
        if(i^j) in  s:
            count += 1

if(count%2==0):
    print 'Karen'

else:
    print 'Koyomi'

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
print ('Karen')

n=int(input())
#xi = list(map(int, input().split()))
#yj = list(map(int, input().split()))
xi = [int(c) for c in input().split()]
yj = [int(c) for c in input().split()]
s=set(xi+yj)
cpt=0;
for i in xi:
    for j in yj:
        result = i ^ j
        if result in s:
            cpt+=1;
if cpt % 2 == 0:
    print("Karen")
else:
    print ("Koyomi")

c= raw_input("")
n = raw_input("").split(" ")
v = {}
k = []
er = []
for i in n:
    v[int(i)] = True
    k.append(int(i))
n = raw_input("").split(" ")
for i in n:
    v[int(i)] = True
    er.append(int(i))
count = 0
for i in k:
    for j in er:
        if i^j in v:
            count += 1
if count % 2 == 0:
    print "Karen"
else:
    print "Koyomi"

n=int(input() )
l=set()

t1=list (map(int,input ().split ()))
t2=list (map(int,input ().split ()))
l=set(t1+t2)

nb=0
for i in range (n) :
    for j in range (n) :
               if (t1[i]^t2[j]) in l :
                   nb+=1

if (nb%2==0):
              print('Karen')
else:
              print('Koyomi')

n=int(input())
xi = list(map(int, input().split()))
yj = list(map(int, input().split()))

s=set(xi+yj)
cpt=0;
for i in xi:
    for j in yj:
        result = i ^ j
        if result in s:
            cpt+=1;
if cpt % 2 == 0:
    print("Karen")
else:
    print ("Koyomi")

n = int(input())
first = list(map(int, input().split()))
second = list(map(int, input().split()))
cnt = 0
for i in range(n):
    for j in range(i, n):
        if first[i] ^ second[j] <= 2 * n:
            cnt += 2
if cnt % 2 == 0:
    print("Karen")
else:
    print("Koyomi")

input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [False] * ((1 << 21) + 1)

for i in range(len(a)):
    x[a[i]] = x[b[i]] = True

cnt = 0
for i in a:
    for j in b:
        if x[i ^ j]:
            cnt += 1

print(['Karen', 'Koyomi'][cnt % 2])

# -*- coding: utf-8 -*-

import math
import collections
import bisect
import heapq
import time
import random

"""
created by shhuan at 2017/10/6 21:41

"""

N = int(input())
X = [int(x) for x in input().split()]
Y = [int(x) for x in input().split()]
print('Karen')

I = lambda: list(map(int, input().split()))

I()
X, Y = I(), I()
Z = set(X) | set(Y)

print('Koyomi' if sum(x^y in Z for x in X for y in Y) % 2 else 'Karen')

n=int(input())
Lko = list(map(int, input().split()))
Lka=list(map(int,input().split()))

E=set(Lko+Lka)

c=0;
for i in range(n) :
    for j in range(n) :
        if((Lko[i]^Lka[j])in E) :
            c=c+1;

if (c%2==0):
    print("Karen")
else:
    print("Koyomi")

n=int(input())
c=0
x=list(map(int,input().split()))
y=list(map(int,input().split()))
z=set(x+y)
for i in range(n):
	for j in range(n):
		if (x[i]^y[j]) in z :
			c = c + 1
if (c%2 == 0):
	print ("Karen")
else:
	print ("Koyomi")

def xor():
    n=int(input())
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    k=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                k+=1;
    if (k%2==0):
        print('Karen')
    else:
        print('Koyomi')
xor()

n=int(input())
xi = list(map(int, input().split()))
yj = list(map(int, input().split()))

s=set(xi+yj)
cpt=0;
for i in xi:
    for j in yj:
        result = i ^ j
        if result in s:
            cpt+=1
if cpt % 2 == 0:
    print("Karen")
else:
    print ("Koyomi")

def solution():
	n = int(input())
	x = [int(a) for a in input().split(' ')]
	y = [int(a) for a in input().split(' ')]
	ans = 0
	for i in range(n):
		current = x[i] ^ y[i]
		if  current in x or current in y:
			ans += 1

	if ans%2 == 0:
		print('Karen')
	else:
		print('Koyomi')

solution()

from itertools import product

r = lambda: map(int, input().split())
input()
x, y = set(r()), set(r())
s = x.union(y)

pairs = sum(x^y in s
            for x, y in product(range(max(x)), range(max(y))))

print('KKoayroemni'[1-pairs%2::2])

def main():
    names = ['Karen', 'Koyomi']
    input()
    x = set(int(c) for c in input().split())
    y = set(int(c) for c in input().split())

    nset = x.union(y)

    pairs = 0
    for xx in range(max(x)+1):
        for yy in range(max(y)+1):
            if xx^yy in nset:
                pairs += 1

    print(names[pairs%2])

if __name__ == '__main__':
    main()

def main():
    names = ['Karen', 'Koyomi']
    input()
    x = set(int(c) for c in input().split())
    y = set(int(c) for c in input().split())

    nset = x.union(y)

    pairs = 0
    for xx in range(max(x)):
        for yy in range(max(y)):
            if xx^yy in nset:
                pairs += 1

    print(names[pairs%2])

if __name__ == '__main__':
    main()

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
i=0
count=0
while i<n:
    j = i
    while j<n:
        z = x[i] ^ y[j]
        if z in x or z in y:
            count+=1
        j+=1
    i+=1
if count%2==0:
    print("Karen")
else:
    print("Koyomi")

n=int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
"""
ab=[]
for i in range(n):
    ab.append(a[i])
for i in range(n):
    ab.append(b[i])
"""
c=0
s=set()
for i in range(n):
    for j in range(n):
        if a[i]^b[j] in s:
            c=c+1
        s.add(b[j])
t=set()
for i in range(n):
    for j in range(n):
        if b[i]^a[j] in s:
            c=c+1
        t.add(a[j])

"""
for i in range(n):
    for j in range(n):
        t=a[i]^b[j]
        if t in ab:
         c=c+1

"""
c=int(c/2)
c=c+1
if c%2==0:
    print("Karen")
else:
    print("Koyomi")

read = lambda: tuple(map(int, input().split()))
n = read()[0]
a = read()
b = read()
s = set()
for va in a: s.add(va)
for vb in b: s.add(vb)
s1 = set()
for i in range(0, n):
    for j in range(0, n):
        s1.add(a[i] ^ b[j])
ans = len(s1 & s)
print("Karen" if ans % 2 == 0 else "Koyomi")

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def solve(n, l1, l2):
    ret = 0
    for i in range(n):
        for j in range(n):
            if l1[i] ^ l2[j] <= 2*n:
                ret += 1
    if ret % 2 == 0:
        return "Karen"
    else:
        return "Koyomi"

def run():
    n = I()
    l1 = LI()
    l2 = LI()
    print(solve(n, l1, l2))

run()

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def solve(n, l1, l2):
    _set = set(range(2*n+1))
    ret = 0
    for i in range(n):
        for j in range(n):
            if l1[i] ^ l2[j] in _set:
                ret += 1
    if ret % 2 == 0:
        return "Karen"
    else:
        return "Koyomi"

def run():
    n = I()
    l1 = LI()
    l2 = LI()
    print(solve(n, l1, l2))

run()

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
x = input().split(' ')
y = input().split(' ')
used = {}
for i in range(n):
    used[x[i]] = 1
    used[y[i]] = 1

    print('Karen')

n=int(input())
ki=list(map(int,input().split()))
ka=list(map(int,input().split()))
count=0
for i in range(len(ki)):
    if(ki[i]^ka[i]) in ki or (ki[i]^ka[i]) in ka:
        count+=1

if count%2==0:
    print("Karen")
else:
    print("Koyomi")

n=int(input())
ki=list(map(int,input().split()))
ka=list(map(int,input().split()))
count=0
for i in range(n):
    if(((ki[i]^ka[i]) in ki ) or ((ki[i]^ka[i]) in ka)):
        count+=1

if count%2==0:
    print("Karen")
else:
    print("Koyomi")

n=int(input())
ar1=list(map(int,input().split()))
ar2=list(map(int,input().split()))
d={}
for i in ar1:
    if i not in d:
        d[i]=i
for i in ar2:
    if i not in d:
        d[i]=i
cnt=0
for i in range(n):
    if ar1[i]^ar2[i] in d:
        cnt+=1
if cnt%2==0:
    print("Karen")
else:
    print("Koyomi")

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def solve(n, l1, l2):
    _set = set(l1) | set(l2)
    ret = 0
    for i in range(n):
        for j in range(n):
            xor = l1[i] ^ l2[j]
            if xor <= 2*n and xor > 0:
                ret += 1
    if ret % 2 == 0:
        print("Karen")
    else:
        print("Koyomi")

def run():
    n = I()
    l1 = LI()
    l2 = LI()
    solve(n, l1, l2)

run()

import sys
# import heapq, collections

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def solve(n, numbers):
    ret = 0
    for i in range(n):
        for j in range(n):
            if numbers[0][i] ^ numbers[1][j] <= 2*n:
                ret += 1
    if ret % 2 == 0:
        return "Karen"
    else:
        return "Koyomi"

def run():
    n = I()
    numbers = [LI() for _ in range(2)]
    print(solve(n, numbers))

run()

n = int(input())
s = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
a = max(max(s),max(d))
b = min(min(s),min(d))
cnt = 0

for i in range(n):
	for j in range(n):
		r = s[i]^d[j]
		if b<=r<=a:
			cnt+=1

if cnt%2==0:
	print("Karen")
else:
	print("Koyomi")

n=int(input())
x=[]
y=[]
z=[]
c=0
x=list(map(int,input().split()))
y=list(map(int,input().split()))
z=x+y
for i in range(0,n):
	for j in range(0,n):
		if (x[i]^y[j]) in z:
			c = c + 1
			break
if (c%2 == 0):
	print ("Karen")
else:
	print ("Koyomi")

import sys

n = int(sys.stdin.readline())
arr1 = list(map(int, sys.stdin.readline().split()))
arr2 = list(map(int, sys.stdin.readline().split()))
cnt = 0
for i in arr1:
    if i % 2 == 0:
        cnt += 1
for i in arr2:
    if i % 2 == 0:
        cnt += 1
print('Karen' if cnt % 2 else 'Koyomi')

import sys

n = int(sys.stdin.readline())
arr1 = list(map(int, sys.stdin.readline().split()))
arr2 = list(map(int, sys.stdin.readline().split()))
cnt = 0
for i in arr1:
    for j in arr2:
       temp = i ^ j
       if temp == 2 * n:
           cnt += 1
print('Karen' if cnt % 2 else 'Koyomi')

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

s = frozenset(a + b)
counter = 0
for i in range(n):
    if (a[i] ^ b[i]) in s:
        counter += 1

if counter % 2 == 1:
    print("Koyomi")
else:
    print("Karen")

n = int(input())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = {x:1 for x in a}
c.update({x:1 for x in b})
count = 0
for i in range(0, n):
    if c.get(a[i]^b[i]):
        count += 1
if count%2 == 0:
    print("Karen")
else:
    print("Koyomi")

n = int(raw_input())

x = map(int,raw_input().split())
y = map(int,raw_input().split())

numbers = set(x+y)

count = 0
for i in range(n):
    for j in range(n):
        if x[i] ^ y[i] in numbers:
            count += 1

if count % 2 ==0:
    print "Karen"
else:
    print "Koyomi"

n=int(input())
l1=list(map(int,input().split()))
l2=list(map(int,input().split()))
l3=l1+l2
r=0
for i in range(n):
    for j in range(n):
        x=l1[i]^l2[i]
        if(x in l3):
            if(i==j):
                r=r+1
            else:
                r=r+2
if(r%2==0):
    print("Karen")
else:
    print("Koyomi")

l1=[]
n=int(input("donner n "))
l1 = list(map(int, input('Enter numbers: ').split()))

l2=[]
l2 = list(map(int, input('Enter numbers: ').split()))

l=l1+l2
tup=[]
for i in range (n):
    for j in range (n):
        if (l1[i]^l2[j] in l ):
            tup.append((l1[i],l2[j]))

if (len(tup) % 2 == 0 ) :
    print("Karen")
else:
    print("Koyomi")

n = int(input())
x = []
y = []
x = input().split()
y = input().split()
for i in range(n):
    x[i] = int(x[i])
    y[i] = int(y[i])
k = 0
for i in range(n):
    if x[i]^y[i] in x or x[i]^y[i] in y:
        k += 1
if k % 2 == 0:
    print("Karen")
else:
    print("Koyomi")

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
amount = 0
for i in range(n):
    value = x[i]^y[i]
    if (value in x) or (value in y):
        amount += 1
if amount%2==0:
    print("Karen")
else:
    print("Koyomi")

n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
amount = 0
for i in range(n):
    for j in range(i, n):
        value = x[i]^y[j]
        if (value in x) or (value in y):
            amount += 1
if amount%2==0:
    print("Karen")
else:
    print("Koyomi")

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
count = 0
c = a+b;
for i in range(len(a)):
	for j in range(i,len(b)):
		if(a[i]^b[j] in c):
			count += 1
if(count%2==0):
	print("Karen")
else:
	print("Koyomi")

KOYOMI = 'Koyomi'
KAREN = 'Karen'

def main():
    input()
    first_str = input().split()
    first = list(map(int, first_str))
    second_str = input().split()
    second = list(map(int, second_str))
    print(game(first, second))

def game(first, second):
    numbers_dict = {}
    for lst in [first, second]:
        for i in lst:
            numbers_dict[i] = 0

    for i in first:
        for j in second:
            result = i ^ j
            if numbers_dict.get(result) is not None:
                numbers_dict[result] += 1

    print(numbers_dict)
    return KOYOMI if sum(numbers_dict.values()) % 2 else KAREN

main()

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)

def main():
    n = I()
    x = LI()
    y = LI()
    c = collections.defaultdict(int)
    d = collections.defaultdict(int)
    for t in x:
        c[t%2] += 1
    for t in y:
        d[t%2] += 1
    k = c[0] * d[0]
    k += c[1] * d[1]

    if k % 2 == 0:
        return 'Karen'

    return 'Koyomi'

print(main())

def the_Artful():
    n=int(input())
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    cpt=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                cpt+=1
    if (cpt%2==0):
        print('Karen')
    else:
        print('Kayomi')

n = int(input())

data = input().split ()
data = input().split ()

print( "karen" )

def the_Artful():
    n=int(input());
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    cpt=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                cpt+=1;
    if (cpt%2==0):
        print('Karen')
    else:
        print('Kayomi')

def the_Artful():
    n=int(input(n));
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    cpt=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j];
            if h in c1:
                cpt+=1;
    if (cpt%2==0):
        print('Karen');
    else:
        print('Koyomi');

def the_Artful():
    n=int(input())
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    cpt=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j]
            if h in c1:
                cpt+=1;
    if (cpt%2==0):
        print('Karen')
    else:
        print('Kayomi')

def the_Artful_Expedient():

    n=int(input());
    x=list(map(int,input().split()));
    y=list(map(int,input().split()));
    cpt=0
    c1=set(x+y)
    for i in range(n):
        for j in range(n):
            h=x[i]^y[j];
            if h in c1:
                cpt+=1;
    if (cpt%2==0):
        print('Karen');
    else:
        print('Koyomi');

import sys
from collections import Counter
import bisect
#sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt','w')

N = int(raw_input())
X = map(int, raw_input().strip().split(' '))
Y = map(int, raw_input().strip().split(' '))
dic = {}
for x in X :
    dic[x] = True
for y in Y :
    dic[y] = True

res = 0
for i in xrange(N) :
    for j in xrange(N) :
        if X[i]^Y[j] in dic :
            res += 1
print res
if res%2 == 0 :
    print 'Karen'
else :
    print 'Koyomi'

import sys
from collections import Counter
import bisect
#sys.stdin = open('input.txt', 'r')
#sys.stdout = open('output.txt','w')

N = int(raw_input())
X = map(int, raw_input().strip().split(' '))
Y = map(int, raw_input().strip().split(' '))
dic = {}
for x in X :
    dic[x] = True
for y in Y :
    dic[y] = True

res = 0
for i in xrange(N) :
    for j in xrange(N) :
        if X[i]^Y[i] in dic :
            res += 1
if res%2 == 0 :
    print 'Karen'
else :
    print 'Koyomi'

n=input()
lst1=map(int,raw_input().split())
lst2=map(int,raw_input().split())
c=0
for i in range(0,n):
  for j in range(0,n):
    s=lst1[i]^lst2[j]
    if s>0 and s<=2*n:
      c=c+1
if c%2==0:
  print "Karen"
else:
  print "Koyomi"

n = int(input())

a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
vis = [False] * 4000007

for i in range(n):
    vis[a[i]] = True
    vis[b[i]] = True

x = 0
for i in range(n):
    for j in range(n):
        if vis[a[i] ^ b[i]]:
            x += 1

print("Karen") if x % 2 == 0 else print("Koyomi")

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def solve(n, l1, l2):
    _set = set(l1) | set(l2)
    ret = 0
    for i in range(n):
        for j in range(n):
            if l1[i] ^ l2[j] <= 2*n:
                ret += 1
    if ret % 2 == 0:
        print("Karen")
    else:
        print("Koyomi")

def run():
    n = I()
    l1 = LI()
    l2 = LI()
    solve(n, l1, l2)

run()

import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()

def solve(n, l1, l2):
    _set = set(range(1, 2*n+1))
    ret = 0
    for i in range(n):
        for j in range(n):
            if l1[i] ^ l2[j] in _set:
                ret += 1
    if ret % 2 == 0:
        return "Karen"
    else:
        return "Koyomi"

def run():
    n = I()
    l1 = LI()
    l2 = LI()
    print(solve(n, l1, l2))

run()

n = int(input())

ko = [int(x) for x in input().split()]
ka = [int(x) for x in input().split()]
kk = ka+ko

cnt = 0

for i in range(n):
    for j in range(i,n):
        x = ko[i]^ka[j]

        if x in kk:
            cnt += 1
            if i==j:
                cnt +=1

if ( cnt%2 == 0 ):
    print('Karen',cnt)
else:
    print('Koyomi',cnt)

n = int(input())

ko = [int(x) for x in input().split()]
ka = [int(x) for x in input().split()]
kk = ka+ko

cnt = 0

for i in range(n):
    for j in range(i,n):
        if ko[i]^ka[j] in kk:
            cnt += 1

if ( cnt%2 == 0 ):
    print('Karen')
else:
    print('Koyomi')

n=int(input())
x=list(map(int,input().split()));
y=list(map(int,input().split()));
k=0
c1=set(x+y)
for i in range(n):
    for j in range(n):
        h=x[i]^y[j]
        if h in c1:
            k+=1;
if (k%2==0):
    print('karen')
else:
    print('koyomi')

input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [False] * ((1 << 21) + 1)

for i in range(len(a)):
    x[a[i]] = x[b[i]] = True

cnt = 0
for i in range(len(a)):
    if x[a[i] ^ b[i]]:
        cnt += 1
    for j in range(i + 1, len(b)):
        if x[a[i] ^ b[j]]:
            cnt += 2

print(['Karen', 'Koyomi'][cnt % 2])

input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [False] * ((1 << 21) + 1)

for i in range(len(a)):
    x[a[i]] = x[b[i]] = True

cnt = 0
for i in range(len(a)):
    for j in range(len(b)):
        if x[a[i] | b[j]]:
            cnt += 1

print(['Karen', 'Koyomi'][cnt % 2])

input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))

x = [False] * ((1 << 21) + 1)

for i in range(len(a)):
    x[a[i]] = x[b[i]] = True

cnt = 0
for i in range(len(a)):
    for j in range(i, len(b)):
        if x[a[i] | b[j]]:
            cnt += 1

print(['Karen', 'Koyomi'][cnt % 2])

from itertools import product
input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ab = set(a + b)

##print([x[0]^x[1] in ab for x in product(a, b)].count(True))

print (len([x for x in product(a, b) if x[0]^x[1] in ab]))

from itertools import product

x = [False] * ((1 << 21) + 1)
input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))

for i in range(len(a)):
    x[a[i]] = x[b[i]] = True

ab = a + b

# print([x[0]^x[1] in ab for x in product(a, b)].count(True))
cnt = 0
for p in product(a, b):
    if x[p[0] | p[1]]:
        cnt += 1

print(['Karen', 'Koyomi'][cnt % 2])

n = int(input())
s = set()
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for _ in x:
	s.add(_)

for _ in y:
	s.add(_)

z = x + y
count = 0

for i in range(len(z)):
	for j in range(i + 1, len(z)):
		if (z[i] ^ z[j]) in s:
			count += 1

print('Karen' if count % 2 == 0 else 'Koyomi')

n = int(input())
s = set()
x = list(map(int, input().split()))
y = list(map(int, input().split()))

for _ in x:
	s.add(_)

for _ in y:
	s.add(_)

z = x + y
count = 0
for i in range(len(z)):
	for j in range(i + 1, len(z)):
		if (i ^ j) in s:
			count += 1

print('Karen' if count % 2 == 0 else 'Koyomi')

my_input = raw_input("Enter").split()

pairs = 0
t = 0
n = 0

current_num = 0

for number in my_input:
  print number
  if t == 0:
    n = int(number)
    t += 1

  if t == 1:
    current_num = int(number)
    for number in my_input:
      if int(number) ^ current_num == (2 * n):
        pairs += 1

if pairs % 2 == 0:
  print "Karen"
elif pairs % 1 == 0:
  print "Koyomi"

n = int(raw_input())
a = map(int, raw_input().split())
b = map(int,raw_input().split())
if n==1:
    print "Koyomi"
else:
    print "Karen"

import time
n = int(raw_input().strip())
li = list(map(int,raw_input().strip().split()))
li1 = list(map(int,raw_input().strip().split()))

start = time.time()
s = set(li)
s1 = set(li1)

count = 0

for i in li:
    for j in li1:
        if(i^j) in  s:
            count += 1

        if(i^j) in s1:
            count += 1

if(count%2==0):
    print 'Karen'

else:
    print 'Koyomi'

print time.time()-start


#!/usr/bin/env python
# coding=utf-8

n = input()
print (n - 2) * (n - 2)

def f(d):
    if d<=3:
        return 1
    else:
        return (d-2)**2

n =  raw_input()
print(f(int(n)))

# Description of the problem can be found at http://codeforces.com/problemset/problem/592/B

print((int(input()) - 2) ** 2)

def the_monster_and_the_squirrel(n):
    return (n-2)**2

if __name__ == "__main__":
    n = int(input())
    result = the_monster_and_the_squirrel(n)
    print(result)

def belochka(n):
    return (n - 2) ** 2

print(belochka(int(input())))

"""
Oh, Grantors of Dark Disgrace,
Do Not Wake Me Again.
"""
print((int(input())-2)**2)

n=int(input())
if (n==3):
    print(1)
else:
    print((n-2)**(2))

import sys
import traceback
from contextlib import contextmanager
from io import StringIO

def jumps(n):
    if n == 3:
        return 1
    return (n * (n-3)) - (n-4)

def main():
    n = int(input())
    print(jumps(n))

def log(*args, **kwargs):
    print(*args, **kwargs, file=sys.stderr)

@contextmanager
def patchio(i):
    try:
        sys.stdin = StringIO(i)
        sys.stdout = StringIO()
        yield sys.stdout
    finally:
        sys.stdin = sys.__stdin__
        sys.stdout = sys.__stdout__

def do_test(k, test):
    try:
        log(f"TEST {k}")
        i, o = test
        with patchio(i) as r:
            main()
        if r.getvalue() == o:
            log("OK\n")
        else:
            log(f"Expected:\n{o}Got:\n{r.getvalue()}")
    except Exception:
        traceback.print_exc()
        log()

def test(ts):
    for k in ts or range(len(tests)):
        do_test(k, tests[k])

tests = [("""\
5
""", """\
9
"""), ("""\
3
""", """\
1
""")]

if __name__ == '__main__':
    from argparse import ArgumentParser
    parser = ArgumentParser()
    parser.add_argument('--test', '-t', type=int, nargs='*')
    args = parser.parse_args()
    main() if args.test is None else test(args.test)

print((int(input())-2)**2)

# Made By Mostafa_Khaled

n=int(input())
k=1
t=3
for i in range(n-3) :
    k=k+t
    t=t+2
print(k)

"""
= raw_input()
L = [ int(i) for i in raw_input().split(' ') ]
= raw_input().split(" ")
"""

def main():
    n = int(raw_input())

    if n == 3:
        print 1
        return
    if n == 4:
        print 4
        return

    print n*(n-3)-(n-4)

main()

import sys

n = int(sys.stdin.readline())
print (n-2)**2

__author__ = 'lavee_singh'
print (input()-2)**2

a = int(raw_input())

if a == 3:
	print 1
elif a == 4:
	print 4
else:
	print (a-2)**2

n = int(raw_input())
t = (n-2)**2
print t

n = int(input())
if n == 3:
    print(1)
elif n == 4:
    print(4)
else:
    print(1 + (n - 3) * (n - 1))

n = raw_input()
n = int(n)
n = ((n-2) * (n-2))
print n

n = int(input())

if n == 3:
    print (1)
elif n == 4:
    print (4)
else:
    a = [0 for i in range(n + 1)]
    a[0] = 1
    a[1] = 1
    for i in range(2, n + 1):
        a[i] = a[i - 2] + a[i - 1]

    print (a[n] + 1)

from sys import stdin

def main():
    inp=stdin
    a=[int(x) for x in inp.readline().strip()]
    while len(a)!=0:
        print((a[0]-2)**2)
        a=[int(x) for x in inp.readline().strip()]
main()

n = int(input())
if n == 3:
    print(1)
elif n == 4:
    print(2)
else:
    ans = (n-3) + 2*(n-3) + (n - 4)* (n-3) + 1
    print(ans)

n=int(input())

if(n==3):

    print('1')

else:

    cnt=((n-1)*2)+1

    print(cnt)

"""
= raw_input()
L = [ int(i) for i in raw_input().split(' ') ]
= raw_input().split(" ")
"""

def main():
    n = int(raw_input())

    if n == 3:
        print 1
        return
    if n == 4:
        print 4
        return

    print n*(n-3)-1

main()

n=int(raw_input())
add=n*(n-3)/2
if add==0:
    print 1
elif add%2==0:
    print add*2
else:
    print add*2-1

n = int(input())
if n == 3:
    ans = 1
elif n == 4:
    ans = 4
else:
    ans = n * (n - 3) - 1
print(ans)

n = int(raw_input())
if n == 3:
	print 1
elif n == 4:
	print 3
else:
	print (n-2)**2

n = int(raw_input().strip())
print 1 + n * (n - 3) - n * (n - 3)
exit(0)
jumps = 1
fulledges = [[] for i in xrange(n)]
brokenedges = [[] for i in xrange(n)]
def modrange(a, b, m):
    curr = a % m
    while curr != b:
        yield curr
        curr += 1
        curr %= m
for v in xrange(n):
    for ov in xrange(n):
        if ov == (v - 1) % n or ov == v or ov == (v + 1) % n:
            continue
        if v not in fulledges[ov]:
            jumps += 1
            broken = False
            if v == 0:
                fulledges[ov].append(v)
                fulledges[v].append(ov)
            continue
            for lv in modrange(v + 1, ov, n):
                for rv in modrange(ov + 1, v, n):
                    if rv in brokenedges[lv]:
                        broken = True
                        break
                if broken:
                    break
            if not broken:
                fulledges[ov].append(v)
                fulledges[v].append(ov)
                brokenedges[ov].append(v)
                brokenedges[v].append(ov)
            else:
                brokenedges[ov].append(v)
                brokenedges[v].append(ov)
print jumps

n = input()
if n == 3:
    print 1
else:
    print n**2 - 3*n - 1

import sys
input=sys.stdin
write=sys.stdout.write
n=int(input.readline())
count=1
k=n*(n-1)
k-=2*n
k-=(n-3)
count+=k
write(str(k))