Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
s = input()

ans = set()
a_alr = []
b_alr = {}

for i in range(10):
    b_alr[str(i)] = []

for i in range(n-2):
    if(s[i] in a_alr):
        continue
    for j in range(i+1,n-1):
        if(s[j] in b_alr[s[i]]):
            continue
        c_alr = set()
        for k in range(j+1,n):
            c_alr = c_alr | set([s[k]])   
            tmp = s[i]+s[j]+s[k]
            ans = ans | set([tmp])
            if(len(c_alr) == 10):
                break

        b_alr[s[i]].append(s[j])
    a_alr.append(s[i])

print(len(ans))

### FIXED CODE ###

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
s = input()

ans = 0
a_alr = []
b_alr = {}

for i in range(10):
    b_alr[str(i)] = []

for i in range(n-2):
    if(len(a_alr) == 10):
        break
    if(s[i] in a_alr):
        continue

    for j in range(i+1,n-1):
        if(len(b_alr[s[i]]) == 10):
            break
        if(s[j] in b_alr[s[i]]):
            continue
        
        ans += len(set(s[j+1:]))
        
        b_alr[s[i]].append(s[j])
    a_alr.append(s[i])

print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
S = [[0]*W for _ in range(H)]

for i in range(H):
    Si = list(input())
    for j in range(W):
        if Si[j] == '#':
            S[i][j] = 1

# row
S_row = [[0]*W for _ in range(H)]
for i in range(H):
    c = 0
    for j in range(W):
        if S[i][j] == 1:
            c = 0
        else:
            c += 1
        S_row[i][j] = c
    # reverse
    for j in range(W-2, -1, -1):
        if S_row[i][j+1] > 0 and S_row[i][j] > 0:
            S_row[i][j] = S_row[i][j+1]

# col
S_col = [[0]*W for _ in range(H)]
for j in range(W):
    c = 0
    for i in range(H):
        if S[i][j] == 1:
            c = 0
        else:
            c += 1
        S_col[i][j] = c
    # reverse
    for i in range(H-2, -1, -1):
        if S_col[i+1][j] > 0 and S_col[i][j] > 0:
            S_col[i][j] = S_col[i+1][j]

# res
res = max([max([S_row[i][j] + S_col[i][j] - 1 for j in range(W)]) for i in range(H)])
print(res)

### FIXED CODE ###

L = []

H, W = map(int, input().split())
for i in range(H):
	S = list(input())
	L.append(S)

ans1 = [[0 for i in range(W)] for j in range(H)]
ans2 = [[0 for i in range(W)] for j in range(H)]

for i in range(H):
	val = 0
	l = []
	for j in range(W):
		if L[i][j] == "#":
			for k in l:
				ans1[i][k] = val
			val = 0
			l = []
		else:
			val += 1
			l.append(j)
	for k in l:
		ans1[i][k] = val

for i in range(W):
	val = 0
	l = []
	for j in range(H):
		if L[j][i] == "#":
			for k in l:
				ans2[k][i] = val
			val = 0
			l = []
		else:
			val += 1
			l.append(j)
	for k in l:
		ans2[k][i] = val


ans = -1
for i in range(H):
	for j in range(W):
		x = ans1[i][j] + ans2[i][j] - 1
		if x > ans:
			ans = x

print(ans)
### BUGGY CODE ###

import numpy as np

n=int(input())
E=[]
W=[]
node_l=np.zeros(n)
node_l[0]=1
for i in range(n-1):
    u,v,w=map(int,input().split())
    #print(u,v,w)
    E.append([u,v])
    W.append(w)
#print(E,W)

def bfs(node,node_l,l,w_l):
    i=0
    A=[]
    L=[]
    for edge in l:
        if edge[0]==node and node_l[edge[1]-1]==0:
            L.append(edge[1])
            A.append(i)
        elif edge[1]==node and node_l[edge[0]-1]==0:
            L.append(edge[0])
            A.append(i)
        i+=1
    if L==[]:
        return
    for j in range(len(L)):
        if W[A[j]]%2==0:
            node_l[L[j]-1]=node_l[node-1]
            bfs(L[j],node_l,l,w_l)
        else:
            node_l[L[j]-1]=node_l[node-1]*-1
            bfs(L[j],node_l,l,w_l)
    return
bfs(1,node_l,E,W)
for i in range(n):
    if node_l[i]==1:
        print('1',end='\n')
    else:
        print('0',end='\n')

### FIXED CODE ###

import numpy as np

n=int(input())
E=[]
node_l=np.zeros(n)
node_l[0]=1
for i in range(n-1):
    u,v,w=map(int,input().split())
    #print(u,v,w)
    E.append((u,v,w))
#print(E,W)

def bfs(node,l):
    root=[[] for i in range(n)]
    for a,b,c in l:
        root[a-1]+=[(b-1,c)]
        root[b-1]+=[(a-1,c)]
    stack=[]
    stack.append(node-1)
    #print(root)
    dist=[-1]*n
    dist[node-1]=0
    while stack:
        #print(stack)
        buf=stack.pop(-1)
        for v,weight in root[buf]:
            if dist[v]==-1:
                dist[v]=dist[buf]+weight
                stack.append(v)
    return dist

for i in bfs(1,E):
    print(i%2,end='\n')
### BUGGY CODE ###

def gcd(a, b):
	if a > b:
		a, b = b, a
	if a % b == 0:
		return b
	while a % b != 0:
		c = a% b
		a = b
		b = c
	else:
		return c

def lcmCalc(x, y):
	return (x * y) // gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

str1 = ""
for i in range(lcm):
	str1 += "-"

for i in range(n):
	index = i * lcm // n + 1
	str1 = str1[:index] + s[i] + str1[index+1:]

flg = 0
for i in range(m):
	index = i * lcm // m + 1
	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
		print("-1")
		flg = 1
		break

if flg == 0:
	print(lcm)

### FIXED CODE ###

def gcd(a, b):
	if a > b:
		a, b = b, a
	if a % b == 0:
		return b
	while a % b != 0:
		c = a% b
		a = b
		b = c
	else:
		return c

def lcmCalc(x, y):
	return (x * y) // gcd(x, y)

n, m = map(int, input().split())
s = input()
t = input()

lcm = lcmCalc(n, m)

# str1 = ""
# for i in range(lcm):
# 	str1 += "-"

flg = 0
for i in range(n):
	index = i * lcm // n + 1
	if (index - 1) % (lcm // m) == 0:
		j = (index - 1) // (lcm // m)
		if s[i] != t[j]:
			print("-1")
			flg = 1
			break
if flg == 0:
	print(lcm)


# 	str1 = str1[:index] + s[i] + str1[index+1:]

# flg = 0
# for i in range(m):
# 	index = i * lcm // m + 1
# 	if str1[index:index+1] != "-" and str1[index:index+1] != t[i]:
# 		print("-1")
# 		flg = 1
# 		break

# if flg == 0:
# 	print(lcm)
### BUGGY CODE ###

import sys
from collections import defaultdict
input = sys.stdin.readline
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = defaultdict(int)
    a.sort()
    ans = 0
    for i in range(n):
        if i < n-1 and a[i] == a[i+1]:
            dic[a[i]] = 1
            continue
        flag = 1
        for e in dic:
            if e >= int(a[i]**2)+1:
                break
            if a[i]%e == 0:
                flag = 0
                break
        if flag:
            ans += 1
        dic[a[i]] = 1
    print(ans)
    
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
 
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 0
    N = max(a)+1
    tab = [1 for _ in range(N)]
    for i in range(n):
        x = a[i]
        if i < n-1 and a[i] == a[i+1]:
            tab[a[i]] = 0
        if tab[x]:
            ans += 1
        for i in range(N):
            if x*i >= N:
                break
            tab[x*i] = 0        
    print(ans)
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(input())
S = list(map(ord, list(input())))
mod = 10**9+7
base = 1234
power = [1]*(N+1)
for i in range(1, N+1):
    power[i] = power[i-1]*base%mod
def check(m):
    if N-m<m:
        return False
    res = 0
    for i in range(m):
        res+=S[i]*power[m-i-1]
        res%=mod
    dic = {res:0}
    for i in range(N-m):
        res = ((res-S[i]*power[m-1])*base
                             +S[i+m])%mod
        if res in dic.keys():
            index = dic[res]
            if index +m<=i+1:
                return True
        else:
            dic[res] = i+1
    return False
ok = 0
ng = N+1
while ng-ok>1:
    mid = (ok+ng)//2
    
    if check(mid):
        ok = mid
    else:
        ng = mid
print(ok)
        


### FIXED CODE ###

N = int(input())
S = input()
ans = 0
for i in range(N):
    if N-i<ans:
        break
    if S[i+1:].find(S[i-ans:i+1])>=0:
        ans += 1
print(ans)
### BUGGY CODE ###

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
expected_value = [(p[i]+1)/2 for i in range(N)]
sum_expected = [sum(expected_value[i:i+K]) for i in range(N-K+1)]
print(max(sum_expected))

### FIXED CODE ###

N, K = list(map(int, input().split()))
p = list(map(int, input().split()))
S = [0]
T = [0]
for i in range(N):
    S.append((p[i]+1)/2 + S[-1])

for i in range(N+1-K):
    T.append(S[i+K]-S[i])

print(max(T))
### BUGGY CODE ###

S = input()
Q = int(input())
Query = [list(map(str,input().split())) for _ in range(Q)]
for i in Query:
    if i[0]=="1":
        S = S[::-1]
    else:
        if i[1]=="1":
            S = i[2]+S
        elif i[1]=="2":
            S = S+i[2]
print(S)

### FIXED CODE ###

S = input()
Q = int(input())
Query = [list(map(str,input().split())) for _ in range(Q)]
from collections import deque 
flag = True
f = ""
l = ""
#print(Query)
for i in Query:
    if i[0]=="1":
        if flag:
            flag = False
        else:
            flag = True
    else:
        if (flag==True and i[1]=="1") or (flag==False and i[1]=="2"):
            f += i[2] 
        elif (flag==True and i[1]=="2") or (flag==False and i[1]=="1"):
            l += i[2]
S = f[::-1]+S+l
if flag:
    print(S)
else:
    print(S[::-1])
### BUGGY CODE ###

# 2018/06/02

class Deque2(object):
    def __init__(self):
        self.a = list()

    def push(self, d, x):
        if d == 0:
            self.a = [x] + self.a
        elif d == 1:
            self.a.append(x)

    def randomAccess(self, p):
        print self.a[p]

    def pop(self, d):
        if d == 0:
            self.a = self.a[1:]
        elif d == 1:
            self.a = self.a[:-1]

    def __repr__(self):
        return " ".join([str(i) for i in self.a])

if __name__ == "__main__":
    d = Deque2()
    q = int(raw_input())
    for i in range(q):
        query = [int(j) for j in raw_input().split()]
        if query[0] == 0:
            d.push(query[1], query[2])
        elif query[0] == 1:
            d.randomAccess(query[1])
        elif query[0] == 2:
            d.pop(query[1])


### FIXED CODE ###

# 2018/06/02

from collections import deque

d = deque()
q = int(raw_input())

for i in range(q):
    query = [int(j) for j in raw_input().split()]
    if query[0] == 0:
        if query[1] == 0:
            d.appendleft(query[2])
        else:
            d.append(query[2])
    elif query[0] == 1:
        print  d[query[1]]
    elif query[0] == 2:
        if query[1] == 0:
            d.popleft()
        else:
            d.pop()
### BUGGY CODE ###

MAX_N = 10000000+1
SQRT_MAX = 3163
sos = [1] * (MAX_N+1)
for i in range(2, SQRT_MAX+1):
    if sos[i]:
        for j in range(i+i, MAX_N+1, i):
            sos[j] = 0

while 1:
    try:
        n = int(input())

        if not n: break
        for i in reversed(range(13, n+1)):
            if sos[i] and sos[i-2] and sos[i-6] and sos[i-8]:
                print(i)
                break
    except:
        pass

### FIXED CODE ###

# from datetime import datetime

# measure_start = datetime.now()
move = [[[10, 10], [4, 4]], [[8, 2],[4, 2]]]

MAX_N = 10000000+1
sos = [1] * (MAX_N+1)
sos[0] = sos[1] = 0
for i in range(2, int(MAX_N**0.5)+1):
    if sos[i]:
        for j in range(i+i, MAX_N+1, i):
            sos[j] = 0

while 1:
    try:
        n = int(input())

        if not n: break
        n -= (n%2 == 0)
        while n >= 13:
            if sos[n] and sos[n-2] and sos[n-6] and sos[n-8]:
                print(n)
                break
            else:
                n -= move[sos[n-8]][sos[n-6]][sos[n-2]]
    # measure_stop = datetime.now()
    # print(measure_stop - measure_start)
    except:
        pass
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
N,M,K=map(int, sys.stdin.readline().split())

par=[ i for i in range(N+1) ]
size=[ 1 for i in range(N+1) ]

def root(x):
    while par[x]!=x:
        x=par[x]
    return x

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y: return
    if size[y]<size[x]: x,y=y,x  #yの要素数を大きく
    size[x]+=size[y]
    par[y]=x

def getsize(x):
	return size[root(x)]

al_ok=[ 0 for i in range(N+1) ]	#隣接で友達関係のカウント

for _ in range(M):
    a,b=map(int, sys.stdin.readline().split())
    unite(a,b)
    al_ok[a]+=1
    al_ok[b]+=1

al_ng=[ 0 for i in range(N+1) ]	#隣接でブロックしている人のカウント
for _ in range(K):
    c,d=map(int, sys.stdin.readline().split())
    if same(c,d):
        al_ng[c]+=1
        al_ng[d]+=1

for i in range(1,N+1):
    print getsize(i)-1-al_ok[i]-al_ng[i],


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
N,M,K=map(int, sys.stdin.readline().split())

par=[ i for i in range(N+1) ]
size=[ 1 for i in range(N+1) ]

def root(x):
    while par[x]!=x:
        x=par[x]
    return x

def same(x,y):
	return root(x)==root(y)

def unite(x,y):
    x=root(x)
    y=root(y)
    if x==y: return
    if size[x]<size[y]: x,y=y,x  #xの要素数が大きいように
    size[x]+=size[y]
    par[y]=x


def getsize(x):
	return size[root(x)]

al_ok=[ 0 for i in range(N+1) ]	#隣接で友達関係のカウント

for _ in range(M):
    a,b=map(int, sys.stdin.readline().split())
    unite(a,b)
    al_ok[a]+=1
    al_ok[b]+=1

al_ng=[ 0 for i in range(N+1) ]	#隣接でブロックしている人のカウント
for _ in range(K):
    c,d=map(int, sys.stdin.readline().split())
    if same(c,d):
        al_ng[c]+=1
        al_ng[d]+=1

for i in range(1,N+1):
    print getsize(i)-1-al_ok[i]-al_ng[i],
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort()
d = [0]*(n-1)
for i in range(n-1):
    d[i]=l[i+1]-l[i]
p = 1
for j in d:
    p = p * j
if p == 0:
    print('NO')
else:
    print('YES')

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort()
s = 'YES'
for i in range(n-1):
    if l[i] == l[i+1]:
        s = 'NO'
print(s)
### BUGGY CODE ###

import itertools

if __name__ == "__main__":
    N = int(input())
    A = input().split()
    for x in range(N):
        tmp = []
        for idx, y in enumerate(A):
            if idx == x:
                continue
            else:
                tmp.append(y)
        result = list(filter(lambda t: t[0] == t[1], list(itertools.combinations(tmp, 2))))
        print(len(result))


### FIXED CODE ###

import sys
import itertools
from collections import Counter
sys.setrecursionlimit(10**8)
if __name__ == "__main__":
    N = int(input())
    A = input().split()
    counter = Counter(A)
    result = 0
    for c in counter.values():
        result += c*(c-1)//2
    for a in A:
        k = counter[a]
        print(result - k*(k-1)//2 + (k-1)*(k-2)//2)
### BUGGY CODE ###

n,W=map(int,input().split())
mv=1
s=[None]*n
for i in range(n):
  s[i]=list(map(int,input().split()))
  mv+=s[i][1]
  
INF=10**9+5
dp=[INF]*mv
dp[0]=0
for i in range(len(s)):
  w=s[i][0]
  v=s[i][1]
  for j in range(len(dp)-v-1,-1,-1):
    if dp[j]+w<dp[j+v]:
      dp[j+v]=dp[j]+w
      
ans=0
for i in range(len(dp)):
  if dp[i]<=W:
    ans=i
    
print(ans)

### FIXED CODE ###

n,W=map(int,input().split())
mv=1
s=[None]*n
for i in range(n):
  s[i]=list(map(int,input().split()))
  mv+=s[i][1]
  
INF=10**9+5
dp=[INF]*mv
dp[0]=0
for i in range(len(s)):
  w=s[i][0]
  v=s[i][1]
  for j in range(len(dp)-v-1,-1,-1):
    if dp[j]+w<dp[j+v]:
      dp[j+v]=dp[j]+w
      
ans=0
for i in range(len(dp)):
  if dp[i]<=W:
    ans=i
    
print(ans)
### BUGGY CODE ###

from collections import defaultdict
import sys
from functools import lru_cache
sys.setrecursionlimit(100000)
N = int(input())
 
counts = [0,0,0]
for a in map(int,input().split()):
  counts[a-1] += 1

A,B,C = counts


# dp[i][j][k] = 残り1個の皿がi枚、残り2個の皿がj枚、残り3個の皿がk枚のときの回数の期待値
# dp[i][j][k] = (i/N)(dp[i-1][j][k])+(j/N)(dp[i+1][j-1][k])+(k/N)(dp[i][j+1][k-1])+(N-i-j-k/N)(dp[i][j][k])+1
# dp[i][j][k] = (i(dp[i-1][j][k])+j(dp[i+1][j-1][k])+k(dp[i][j+1][k-1])+N)/(i+j+k)
dp = [[[None]*(C+1) for _ in range(B+C+1)] for _ in range(A+B+C+1)]
dp[0][0][0] = 0

@lru_cache(maxsize=None)
def h(i,j,k):
  if dp[i][j][k] is None:
    dp[i][j][k] =((i*h(i-1,j  ,k  ) if i else 0)+
                  (j*h(i+1,j-1,k  ) if j else 0)+
                  (k*h(i  ,j+1,k-1) if k else 0)+
                  N)/(i+j+k)
  return dp[i][j][k]

print(h(A,B,C))

### FIXED CODE ###

from collections import defaultdict
import sys
from functools import lru_cache
sys.setrecursionlimit(100000)
N = int(input())
 
counts = [0,0,0]
for a in map(int,input().split()):
  counts[a-1] += 1

A,B,C = counts


# dp[i][j][k] = 残り1個の皿がi枚、残り2個の皿がj枚、残り3個の皿がk枚のときの回数の期待値
# dp[i][j][k] = (i/N)(dp[i-1][j][k])+(j/N)(dp[i+1][j-1][k])+(k/N)(dp[i][j+1][k-1])+(N-i-j-k/N)(dp[i][j][k])+1
# dp[i][j][k] = (i(dp[i-1][j][k])+j(dp[i+1][j-1][k])+k(dp[i][j+1][k-1])+N)/(i+j+k)
dp = [[[None]*(C+1) for _ in range(B+C+1)] for _ in range(A+B+C+1)]
dp[0][0][0] = 0

for k in range(C+1):
  for j in range(B+C+1-k):
    for i in range(A+B+C+1-k-j):
      try:
        dp[i][j][k] =((i*dp[i-1][j][k] if i else 0)+
                      (j*dp[i+1][j-1][k] if j else 0)+
                      (k*dp[i][j+1][k-1] if k else 0)+
                      N)/(i+j+k)
      except ZeroDivisionError:
        pass

print(dp[A][B][C])
### BUGGY CODE ###

N = int(input())
a = list(map(int,input().split()))
ans = float('inf')
for i in range(1,N):
    x = abs(sum(a[:i])-sum(a[i:]))
    if x < ans:
        ans = x
print (ans)


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
total = sum(a)
ans = float('inf')
x = 0
for i in range(N-1):
    x += a[i]
    ans = min(abs(total-2*x),ans)
print (ans)
### BUGGY CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
if K <42:
    for q in range(K):
        foo = [1 for k in range(N)]
        for k in range(N):
            for j in range(1, min(A[k]+1, N-k)):
                foo[k+j] +=1
            for j in range(1, min(A[k]+1, k+1)):
                foo[k-j] +=1
        #print(foo)

        for k in range(N):
            A[k] = foo[k]
        #print(A)
else:
    for k in range(N):
        A[k] = N
ans = ""
for k in range(len(A)):
    ans += str(A[k]) + " "

print(ans.rstrip())

### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = [[0 for k in range(N)] for k in range(42)]
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        unko = [0 for k in range(N)]
        for k in range(N):
            if k + foo[q][k]+1 < N:
                unko[k + foo[q][k]+1] -=1
            unko[max(k - foo[q][k], 0)] +=1
        unchi = 0
        for k in range(N):
            unchi += unko[k]
            foo[q+1][k] = unchi
        #print(unko)
        #print(foo[q+1])
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))
### BUGGY CODE ###

def main():
     s = list(input())
     results=[s]
     for i in range(1,len(s)):
         for j in range(0,len(s)-i):
             temp = s.copy()
             temp[j:j+i+1] = reversed(temp[j:j+i+1])
             if temp not in results:
                 results.append(temp)
     print(len(results))

if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
     s = list(input())
     count = int((len(s)*(len(s)-1))/2+1)
     dic = {}
     for i in range(len(s)):
         try:
             dic[s[i]].append(i)
         except Exception:
             dic[s[i]] = [i]

     for j in dic.values():
         count-=int((len(j)*(len(j)-1))/2)
     print(count)


if __name__=="__main__":
    main()
### BUGGY CODE ###

#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[(7*i+j-7)%11 for j in range(1, 7+1)] for i in range(1, n+1)]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(n-2, 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * (n // 11)
for i in range(n % 11 - 2):
    cnt += h[i%11]
print(cnt)

### FIXED CODE ###

#! /usr/bin/env python3

n, k = map(int, input().split())
M = [[7*i+j-7 for j in range(1, 7+1)] for i in range(1, min(n+1, 14))]
cnt = 0
f = lambda i, j : sum(M[i+y][j+x] for y in range(3) for x in range(3)) % 11 == k
h = [0] * 11
for i in range(min(max(0, n-2), 11)):
    for j in range(7-2):
        if f(i, j) :
            h[i] += 1
cnt = sum(h) * ((n-2) // 11)
for i in range((n-2) % 11):
    cnt += h[i]
print(cnt)
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

import numpy as np

def GaussJordan(A, is_extended = False):
    rank = 0
    for col in range(len(A[0])):
        if (is_extended and col == len(A[0])-1):
            break
        pivot = -1
        for row in range(rank,len(A)):
            if A[row][col]:
                pivot = row
                break
        if pivot == -1: 
            continue
        A[[pivot,rank]] = A[[rank,pivot]]
        for row in range(len(A)):
            if (row != rank and A[row][col]):
                A[row] ^= A[rank]
        rank += 1
    return A

N = I()
A = III()

xor = 0
for i in range(N):
    xor ^= A[i]
xor = format(xor,'b').zfill(60)

digit = defaultdict(int)
use_digit = []
not_use_digit = []
for j in range(60)[::-1]:
    if xor[60-j-1] == '0':
        digit[j] = 1
        use_digit.append(j)
    else:
        not_use_digit.append(j)

a = np.zeros((N,len(use_digit)), dtype=int)
for i in range(N):
    k = 0
    for j in range(60)[::-1]:
        if digit[j]:
            if A[i]>>j & 1:
                a[i][k] = 1
            else:
                a[i][k] = 0
            k += 1

g = GaussJordan(a,False)

ans = 0
for j in not_use_digit:
    ans += 2**j

s = np.zeros(len(use_digit),dtype=int)
for i in range(N):
    for j in range(len(use_digit)):
        if g[i][j]==1:
            s ^= g[i]
            break

for k in range(len(s)):
    ans += s[k]*2**(use_digit[k]+1)

print(ans)

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N = I()
A = III()

xor = 0
for i in range(N):
    xor ^= A[i]

for i in range(N):
    A[i] &= ~xor

max_digit = len(format(max(A), 'b'))
rank = 0
for col in range(max_digit)[::-1]:
    pivot = -1
    for row in range(rank,N):
        if A[row]>>col & 1:
            pivot = row
            break
    if pivot == -1: 
        continue
    A[pivot],A[rank] = A[rank],A[pivot]
    for row in range(rank+1,N):
        if A[row]>>col & 1:
            A[row] ^= A[rank]
    rank += 1

val = 0
for i in range(N):
    val = max(val,val^A[i])

print(2*val + xor)