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

n = int(input())

l = []
for i in range(n) :
    a = int(input())
    l.append(a)

count = 0   
for j in set(l):
    if l.count(j) %2 == 1 :
         count += 1

print(count)

### FIXED CODE ###

n = int(input())

answer = {}
for i in range(n):
  ai = int(input())
  if answer.get(ai):
    answer.pop(ai)
  else:
    answer[ai] = 1
    
print(len(answer))
### BUGGY CODE ###

# Picking Up
# グラフ,有向グラフ,ベクトル, ２次元、コスト,

N = int(input())
S = []
for _ in range(N):
    x, y = map(int, input().split())
    S.append([x, y])
cost = N

for k in range(len(S)):
    for i in range(len(S)):
        if k == i:
            continue
        t_vec_x1 = S[i][0] - S[k][0]
        t_vec_y1 = S[i][1] - S[k][1]
        edge = 0
        for l in range(len(S)):
            for m in range(len(S)):
                if l == m:
                    continue
                vec_x = S[m][0] - S[l][0]
                vec_y = S[m][1] - S[l][1]
                if t_vec_x1 == vec_x and t_vec_y1 == vec_y:
                    edge += 1
        cost = min(cost, N - edge)
        t_vec_x2 = S[k][0] - S[i][0]
        t_vec_y2 = S[k][1] - S[i][1]
        edge = 0
        for l in range(len(S)):
            for m in range(len(S)):
                if l == m:
                    continue
                vec_x = S[l][0] - S[m][0]
                vec_y = S[l][1] - S[m][1]
                if t_vec_x2 == vec_x and t_vec_y2 == vec_y:
                    edge += 1
        # print(edge)
        cost = min(cost, N - edge)

print(cost)


### FIXED CODE ###

# Picking Up
# グラフ,有向グラフ,ベクトル, ２次元、コスト,

N = int(input())
S = []
for _ in range(N):
    x, y = map(int, input().split())
    S.append([x, y])
cost = N
d = {}

if N==1:
    print(1)
    exit()
for l,le in enumerate(S):
    for m, me in enumerate(S):
        if l == m:
            continue
        t = (me[0] - le[0], me[1] - le[1])
        if t in d:
            d[t] +=1
        else:
            d[t] = 1

print(N - max(d.values()))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n, k = map(int, input().split())
pl = list(map(int, input().split()))

ans = 0

for i in range(n):
    pl[i] = (pl[i]*(pl[i]+1)/2/pl[i])
    if i >= k-1:
        if sum(pl[i-k+1:i+1]) > ans:
            ans = sum(pl[i-k+1:i+1])

print(ans)


### FIXED CODE ###

n, k = map(int, input().split())
pl = list(map(int, input().split()))

dp = [0] * (n + 1)

for i in range(n):
    dp[i+1] = dp[i] + (pl[i] + 1)/2

ans = 0
for i in range(k, n+1):
    ans = max(ans, dp[i] - dp[i-k])

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

def gcd(a,b):
    if ( b==0 ):
        return a
    else:
        return (gcd(b, a%b))

kosuu = int(input())
nums = list(map(int,input().split()))

i=0
saidai = []
while i < len(nums):
    x,l=0,0
    while x < i:
        l = gcd(l,nums[x])
        x += 1
    y,r = i+1,0
    while y < len(nums):
        r = gcd(r,nums[y])
        y +=1
    i +=1
    saidai.append(gcd(l,r))

print(max(saidai))

### FIXED CODE ###

def gcd(a,b):
    if ( b==0 ):
        return a
    else:
        return (gcd(b, a%b))

kosuu = int(input())
nums = list(map(int,input().split()))

L = []
R = []
for temp in range(kosuu-1):
    if temp == 0:
        L.append(nums[0])
    else:
        L.append(gcd(L[temp-1],nums[temp]))

for temp in range(kosuu-1):
    if temp == 0:
        R.append(nums[kosuu-1])
    else:
        R.append(gcd(R[temp-1],nums[len(nums)-temp-1]))

saidai=[]
for i in range(kosuu):
    if i == 0:
        saidai.append(L[-1])
    elif i == kosuu-1:
        saidai.append(R[-1])
    else:
        saidai.append(gcd(L[i-1],R[-1-i]))

print(max(saidai))
### BUGGY CODE ###

N = int(input())
num_list =  [int(i) for i in input().split()]
sum = 0
mod = 10 ** 9 + 7
for s in range(N):
    e = s + 1
    while e < N:
        result = num_list[s] * num_list[e]
        #print(str(result) + " = " + str(num[s]) + "*" + str(num[e]))
        sum += result % mod
        e += 1
print(sum % mod)

### FIXED CODE ###

N = int(input())
num_list =  [int(i) for i in input().split()]
result = 0
mod = 10 ** 9 + 7
right = sum(num_list)
for number in num_list:
    #A*B + A * C = A*(B+C)で計算
    right -= number
    result += (number * right) % mod
print(result % mod)
### BUGGY CODE ###

N, m, l = map(int, input().split())
graph = [[] for i in range(N+1)]

INF = 2 ** 63 - 1
d = [[INF for i in range(N+1)] for j in range(N+1)]
for i in range(N+1):
    d[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    d[a][b] = c
    d[b][a] = c


for k in range(N+1):
    for i in range(N+1):
        for j in range(N+1):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

d2 = [[INF for i in range(N+1)] for j in range(N+1)]
for i in range(N+1):
    d[i][i] = 0

for i in range(N+1):
    for j in range(N+1):
        if d[i][j] <= l:
            d2[i][j] = 1

for k in range(N+1):
    for i in range(N+1):
        for j in range(N+1):
            d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j])

q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    if d2[s][t] == INF:
        print(-1)
    else:
        print(d2[s][t] - 1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, m, l = map(int, input().split())
graph = [[] for i in range(N+1)]

INF = 2 ** 31 - 1
d = [[INF for i in range(N+1)] for j in range(N+1)]
for i in range(N+1):
    d[i][i] = 0
for i in range(m):
    a, b, c = map(int, input().split())
    d[a][b] = c
    d[b][a] = c


for k in range(N+1):
    for i in range(N+1):
        for j in range(N+1):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

d2 = [[INF for i in range(N+1)] for j in range(N+1)]
for i in range(N+1):
    d[i][i] = 0

for i in range(N+1):
    for j in range(N+1):
        if d[i][j] <= l:
            d2[i][j] = 1

for k in range(N+1):
    for i in range(N+1):
        for j in range(N+1):
            d2[i][j] = min(d2[i][j], d2[i][k] + d2[k][j])


q = int(input())
for i in range(q):
    s, t = map(int, input().split())
    if d2[s][t] == INF:
        print(-1)
    else:
        print(d2[s][t] - 1)
### BUGGY CODE ###

N = int(input())
d = [0] * N
INF = float('inf')

cost = [[INF] * N for i in range(N)]
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    cost[a - 1][b- 1] = c
    cost[b- 1][a - 1] = c
    
def dijkstra(s):
    used = [False] * N
    for i in range(N):
        d[i] = INF
    d[s] = 0
    
    while True:
        v = -1
        for u in range(N):
            if used[u] == False and (v == -1 or d[u] < d[v]):
                v = u
        if v == -1:
            break
        used[v] = True
        
        for u in range(N):
            d[u] = min(d[u], d[v] + cost[v][u])
            
Q, K = map(int, input().split())

dijkstra(K - 1)

for _ in range(Q):
    ans = 0
    x, y = map(int, input().split())
    ans += d[x - 1]
    ans += d[y - 1]
    print(ans)

### FIXED CODE ###

import heapq

N = int(input())
d = [0] * N
INF = float('inf')

class Info:
    def __init__(self, to, cost):
        self.to = to
        self.cost = cost
        
G = [[] for i in range(N)]
for _ in range(N - 1):
    a, b, c = map(int, input().split())
    G[a - 1].append(Info(b - 1, c))
    G[b - 1].append(Info(a - 1, c))
    
def dijkstra(s):
    for i in range(N):
        d[i] = INF
    d[s] = 0
    h = []
    heapq.heappush(h, [0, s])
    
    while h != []:
        p = heapq.heappop(h)
        v = p[1]
        if d[v] < p[0]:
            continue
        for i in range(len(G[v])):
            e = G[v][i]
            if d[e.to] > d[v] + e.cost:
                d[e.to] = d[v] + e.cost
                heapq.heappush(h, [d[e.to], e.to])

Q, K = map(int, input().split())

dijkstra(K - 1)

for _ in range(Q):
    ans = 0
    x, y = map(int, input().split())
    ans += d[x - 1]
    ans += d[y - 1]
    print(ans)
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [input() for _ in range(H)]

move = ((1, 0), (-1, 0), (0, 1), (0, -1))
que = deque([(Ch-1, Cw-1, 0)])

visited = [[-1] * W for _ in range(H)]
while que:
    ci, cj, d = que.popleft()
    if visited[ci][cj] == -1:
        visited[ci][cj] = d

    for di, dj in move:
        ni, nj = ci + di, cj + dj
        if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] != -1:
            continue
        if S[ni][nj] == '.':
            visited[ni][nj] = d
            que.appendleft((ni, nj, d))

    for di in range(-2, 3):
        for dj in range(-2, 3):
            ni, nj = ci+di, cj+dj
            if not (0 <= ni < H and 0 <= nj < W)  \
                    or visited[ni][nj] != -1:
                continue
            if S[ni][nj] == '.':
                que.append((ni, nj, d+1))


# print(visited)
if visited[Dh-1][Dw-1] == -1:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])


### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
Ch, Cw = map(int, input().split())
Dh, Dw = map(int, input().split())
S = [list(input()) for _ in range(H)]

visited = [[-1] * W for _ in range(H)]

que = deque([(Ch-1, Cw-1, 0)])
move = ((1, 0), (-1, 0), (0, 1), (0, -1))
while que:
    ci, cj, d = que.popleft()

    if visited[ci][cj] != -1:
        continue
    visited[ci][cj] = d

    for di, dj in move:
        ni, nj = ci + di, cj + dj
        if not (0 <= ni < H and 0 <= nj < W) or visited[ni][nj] != -1:
            continue
        if S[ni][nj] == '.':
            que.appendleft((ni, nj, d))

    for di in range(-2, 3):
        for dj in range(-2, 3):
            ni, nj = ci+di, cj+dj
            if not (0 <= ni < H and 0 <= nj < W)  \
                    or visited[ni][nj] != -1:
                continue
            if S[ni][nj] == '.':
                que.append((ni, nj, d+1))
    # print(visited)
    # exit()

if visited[Dh-1][Dw-1] == -1:
    print(-1)
else:
    print(visited[Dh-1][Dw-1])
### BUGGY CODE ###

a,b,k=map(int,input().split())
cnt=0
for i in range(k):
  if a>=1:
    a-=1
  elif b>=1:
    b-=1
  else:
    break
print("{} {}".format(a,b))

### FIXED CODE ###

a,b,k=map(int,input().split())
cnt=0
if k>=(a+b):
  print("{} {}".format(0,0))
elif k>=a and k-a<=b:
  print("{} {}".format(0,b-k+a))
elif k<a:
  print("{} {}".format(a-k,b))
### BUGGY CODE ###

n, m = map(int, input().split())
a = [0]*m
for _ in range(m):
    a[_] = int(input()) 
s = [1]*(n+1)

if 1 in a:
    s[1] = 0

for i in range(2,n+1):
    if i in a:
        s[i] = 0
        continue
    s[i] = (s[i-1] + s[i-2]) % (10**9+7)

print(s[-1])

### FIXED CODE ###

n, m = map(int, input().split())
a = set([int(input()) for _ in range(m)])

s = [1]*(n+1)

if 1 in a:
    s[1] = 0

for i in range(n-1):
    if i+2 in a:
        s[i+2] = 0
        continue
    s[i+2] = (s[i+1] + s[i]) % (10**9+7)
    
print(s[-1])
### BUGGY CODE ###

N, K = map(int ,input().split())
mod = 10**9+7
B = K
R = N-K

def nCk_mod(n,k,mod):
	if n < k:
		return 1
	out = 1
	for i in range(n-k+1,n+1):
		out *= i
		out %= mod
	for i in range(1,k+1):
		out *= pow(i,mod-2,mod)
		out %= mod

	return out

ans = []

for i in range(1,B+1):
	if R < i-1:
		ans.append(0)
		continue
	s_1 = nCk_mod(B-1,i-1,mod)
	s_2 = nCk_mod(R+1, i, mod)

	ans.append((s_1*s_2)%mod)

for a in ans:
    print(a, end=" ")
print()

### FIXED CODE ###

N, K = map(int ,input().split())
mod = 10**9+7
B = K
R = N-K

def nCk_mod(n,k,mod):
	if n < k:
		return 1
	out = 1
	for i in range(n-k+1,n+1):
		out *= i
		out %= mod
	for i in range(1,k+1):
		out *= pow(i,mod-2,mod)
		out %= mod

	return out

ans = []

for i in range(1,B+1):
	if R < i-1:
		ans.append(0)
		continue
	s_1 = nCk_mod(B-1,i-1,mod)
	s_2 = nCk_mod(R+1, i, mod)

	ans.append((s_1*s_2)%mod)

for a in ans:
    print(a, end=" ")
print()
### BUGGY CODE ###

class Combination:
    '''
    計算量：階乗・逆元テーブルの作成O(N)
            nCkを求めるO(1)
    '''

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD


n, a, b, k = map(int, input().split())
MOD = 998244353
comb = Combination(n, MOD)
ans = 0
for i in range(n+1):
    if not(k - a*i >= 0 and (k - a*i) % b == 0 and (k - a*i) // b <= n):
        continue
    else:
        ai = i
        bi = (k - a*i) // b
        ans += comb.combination(n, ai) * comb.combination(n, bi)
        ans %= MOD
print(ans)

### FIXED CODE ###

class Combination:
    '''
    計算量：階乗・逆元テーブルの作成O(N)
            nCkを求めるO(1)
    '''

    def __init__(self, n, MOD):
        self.fact = [1]
        for i in range(1, n + 1):
            self.fact.append(self.fact[-1] * i % MOD)
        self.inv_fact = [pow(self.fact[i] ,MOD - 2 ,MOD) for i in range(n + 1)]
        self.MOD = MOD

    def factorial(self, k):
        '''k!を求める'''
        return self.fact[k]

    def inverse_factorial(self, k):
        '''k!の逆元を求める'''
        return self.inv_fact[k]

    def combination(self, k, r):
        '''kCrを求める'''
        return (self.fact[k] * self.inv_fact[k - r] * self.inv_fact[r]) % self.MOD


n, a, b, k = map(int, input().split())
MOD = 998244353
comb = Combination(n, MOD)
ans = 0
for i in range(n+1):
    if not(k - a*i >= 0 and (k - a*i) % b == 0 and (k - a*i) // b <= n):
        continue
    else:
        ai = i
        bi = (k - a*i) // b
        ans += comb.combination(n, ai) * comb.combination(n, bi)
        ans %= MOD
print(ans)
### BUGGY CODE ###

def z_array(pattern, text):
    str = pattern + '$' + text
    z = []
    z.append(0)
    for i in range(len(str)-1):
        j = 0
        z.append(0)
        while (i+1+j <= len(str)-1 and str[j] == str[i+1+j]):
            j += 1
            z[i+1] = j
    return z

def main(size, text):
    length = 0
    for i in range(size-1):
        z = z_array(text[i+1:size], text[:i+1])
        if(length < max(z)):
            length = max(z)
    return length

size = int(input())
text = input()
print(main(size, text))

### FIXED CODE ###

def main(size, text):
    pattern = ""
    matchlen = 0

    for i in range(size):
        pattern += text[i]
        while (len(pattern) > 0 and len(pattern) <= len(text[i+1:])):
            if pattern in text[i+1:]:
                matchlen = max(matchlen, len(pattern))
                break
            else:
                pattern = pattern[1:]
    
    return matchlen

if __name__ == '__main__':
    N = int(input())
    S = input()
    print (main(N, S))
### BUGGY CODE ###

def resolve():
    n,p=map(int,input().split())
    s=str(input())

    cnt=0
    for i in range(n):
        for j in range(i+1,n+1):
            if int(s[i:j])%p==0:
                cnt+=1

    print(cnt)

resolve()

### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    N, P = map(int, input().split())
    S = str(input())

    def main():
        if P == 2:
            res = 0
            for i in range(N):
                if int(S[N - 1 - i]) % 2 == 0:
                    res += N - i
        elif P == 5:
            res = 0
            for i in range(N):
                if int(S[N - 1 - i]) == 0 or int(S[N - 1 - i]) == 5:
                    res += N - i

        else:
            mods = [0] * P  # mods[i]はPで割ったあまりがiである連続部分列の個数
            tenfactor = 1
            mod = 0
            mods[mod] += 1

            for i in range(N):
                mod = (mod + int(S[N - i - 1]) * tenfactor) % P
                tenfactor = (tenfactor * 10) % P
                mods[mod] += 1

            res = 0
            for p in range(P):
                res += mods[p] * (mods[p] - 1) // 2

        return res

    print(main())


resolve()
### BUGGY CODE ###

import sys
    
global status, d
status = {}
d=0

def mst(p1, GRAPH):
    global status
    
    edge={}
    total = 0
    mini = 0
    while True:
        status[p1]=True
        for p2 in range(len(status)):
            if status[p2]==False and GRAPH.has_key((p1,p2)):
                edge[(p1, p2)]=GRAPH[(p1, p2)]
                if mini<GRAPH[(p1,p2)]:
                    mini=GRAPH[(p1,p2)]
        for key, value in edge.items():
            if status[key[1]]==True:
                del edge[key]
                continue
            if value <mini:
                key0 = key
                mini = value
        if mini!=2000:
            total+=mini
            p1=key0[1]
        else:
            break
    
    return total

n = int(raw_input())
x = {}
for i in range(n):
    seq = map(int,raw_input().split())
    for j in range(n):
        tmp = seq[j]
        if tmp != -1:
            x[(i, j)]=tmp
    status[i] = False

print mst(0, x)

### FIXED CODE ###

import sys
    
global status, d
status = {}
d=0

def mst(p1, GRAPH):
    global status
    
    edge={}
    total = 0
    mini = 0
    while True:
        status[p1]=True
        for p2 in range(len(status)):
            if status[p2]==False and GRAPH.has_key((p1,p2)):
                edge[(p1, p2)]=GRAPH[(p1, p2)]
        mini=1000000
        for key, value in edge.items():
            if status[key[1]]==True:
                del edge[key]
                continue
            if value <mini:
                key0 = key
                mini = value
        if mini!=1000000:
            total+=mini
            p1=key0[1]
        else:
            break
    
    return total

n = int(raw_input())
x = {}
for i in range(n):
    seq = map(int,raw_input().split())
    for j in range(n):
        tmp = seq[j]
        if tmp != -1:
            x[(i, j)]=tmp
    status[i] = False

print mst(0, x)
### BUGGY CODE ###

N = int(input())
P = list(map(int,input().split()))
 
cnt = 0
num = min(P)

for i in range(1,N+1):
  M = min(P[:i])
  if M == P[i-1]:
    cnt += 1
  if num == M:
    break
    
cnt_2 = P.count(num)
    
print(cnt+cnt_2-1)

### FIXED CODE ###

N = int(input())
P = list(map(int,input().split()))
 
cnt = 0
M = 10**6

for i in range(N):
  if M >= P[i]:
    cnt += 1
    M = P[i]
    
print(cnt)
### BUGGY CODE ###

n = int(input())
s = input()
r = []
g = []
b = []
for i in range(n):
  if s[i] == 'R':
    r.append(i)
  elif s[i] == 'G':
    g.append(i)
  else:
    b.append(i)
ans = 0
for ri in r:
  for gi in g:
    for bi in b:
      a = [ri,gi,bi]
      a.sort()
      if a[1]-a[0] != a[2]-a[1]:
        ans += 1
print(ans)

### FIXED CODE ###

import bisect

n = int(input())
s = input()
rgb = [[],[],[]]
for i in range(n):
  if s[i] == 'R':
    rgb[0].append(i)
  elif s[i] == 'G':
    rgb[1].append(i)
  else:
    rgb[2].append(i)
x = []
for i in range(3):
  x.append((len(rgb[i]),i))
x.sort()
y = []
for i in range(3):
  y.append(rgb[x[i][1]])
a = 0
for y0 in y[0]:
  for y1 in y[1]:
    b = (y0+y1)//2
    if abs(b-y0) == abs(b-y1):
      r = bisect.bisect_left(y[2],b)
      if r < len(y[2]) and y[2][r] == b:
        a += 1
    b = min(y0,y1)-abs(y0-y1)
    if b >= 0:
      r = bisect.bisect_left(y[2],b)
      if r < len(y[2]) and y[2][r] == b:
        a += 1
    b = max(y0,y1)+abs(y0-y1)
    if b < n:
      r = bisect.bisect_left(y[2],b)
      if r < len(y[2]) and y[2][r] == b:
        a += 1
print(len(y[0])*len(y[1])*len(y[2])-a)
### BUGGY CODE ###

mod = 1000000007
n, m = map(int, input().split())
dat_m = []
dp = [0] * (n + 1)
for i in range(m):
    dat_m.append(int(input()))

dp[0] = 1
for i in range(1, n + 1):
    #print(dp)
    dp[i] = dp[i - 1]
    if i > 1:
        dp[i] += dp[i - 2]
    if i in dat_m:
        dp[i] = 0
    dp[i] = dp[i] % mod

print(dp[n])

### FIXED CODE ###

mod = 1000000007
n, m = map(int, input().split())
dat_m = []
dp = [0] * (n + 1)
for i in range(m):
    t = int(input())
    dp[t] = -1

dp[0] = 1
for i in range(1, n + 1):
    if dp[i] == -1:
        dp[i] = 0
        continue
    dp[i] = dp[i - 1]
    if i > 1:
        dp[i] += dp[i - 2]
    if i in dat_m:
        dp[i] = 0
    dp[i] = dp[i] % mod

print(dp[n])
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
x=10**18
ans=1
for num in a:
    ans*=num
    if 0 in a:
        ans=0
        break
    if ans>x:
        ans=-1
        break    
print(ans)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
x=10**18
ans=1
for num in a:
    ans*=num
    if ans>x:
        ans=-1
        break
if 0 in a:
    ans=0   
print(ans)
### BUGGY CODE ###

from itertools import permutations


def solve(n, m, r):
    ans = float('inf')
    d = [[float("inf")]*n for _ in range(n)]
    rx = list(i-1 for i in map(int, input().split()))

    for i in range(m):
        s, t, length = map(int, input().split())
        d[s-1][t-1] = length
        d[t-1][s-1] = length

    for i in range(n):
        d[i][i] = 0

    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    for p in permutations(rx, r):
        from_p1_to_pr = 0
        for p_j,  p_next in zip(p, p[1:]):
            from_p1_to_pr += d[p_j][p_next]
        ans = min(ans, from_p1_to_pr)

    return ans


if __name__ == '__main__':
    n, m, r = map(int, input().split())
    print(solve(n, m, r))


### FIXED CODE ###

from itertools import permutations


def solve(n, m, r):
    ans = 10**18
    d = [[10**18]*n for _ in range(n)]
    rx = list(i-1 for i in map(int, input().split()))

    for i in range(m):
        s, t, length = map(int, input().split())
        d[s-1][t-1] = length
        d[t-1][s-1] = length

    for i in range(n):
        d[i][i] = 0

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dt = d[i][k] + d[k][j]
                if dt < d[i][j]:
                    d[i][j] = dt

    for p in permutations(rx):
        from_p1_to_pr = 0
        for p_j,  p_next in zip(p, p[1:]):
            from_p1_to_pr += d[p_j][p_next]
        if from_p1_to_pr < ans:
            ans = from_p1_to_pr

    return ans


if __name__ == '__main__':
    n, m, r = map(int, input().split())
    print(solve(n, m, r))
### BUGGY CODE ###

from collections import Counter
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
p, q, r = cnt[1], cnt[2], cnt[3]

dp = []
for _ in range(n + 1):
    dp.append([[0] * (n + 1) for _ in range(n + 1)])
dp[0][0][0] = 0

for k in range(r + 1):
    for j in range(r + q + 1):
        for i in range(n + 1):
            if not (0 < (i + j + k) <= n):
                continue
            tmp = 0
            if i > 0:
                tmp += dp[i - 1][j][k] * i
            if j > 0:
                tmp += dp[i + 1][j - 1][k] * j
            if k > 0:
                tmp += dp[i][j + 1][k - 1] * k
            tmp += n
            dp[i][j][k] = tmp / (i + j + k)

print(dp[p][q][r])


### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())

N = NI()
a = [0,0,0]
for x in LI():
    a[x-1] += 1
dp = [[[0.0] * (N+1) for _ in range(N+1)] for _ in range(N+1)]

for k in range(a[2]+1):
    for j in range(a[1]+a[2]+1):
        for i in range(N+1):
            if not (0 < i+j+k <= N): continue
            x = 0.0
            if i > 0: x += dp[i-1][j][k] * (i/N)
            if j > 0: x += dp[i+1][j-1][k] * (j/N)
            if k > 0: x += dp[i][j+1][k-1] * (k/N)
            x += 1.0
            x *= N / (i+j+k)
            dp[i][j][k] = x
print(dp[a[0]][a[1]][a[2]])
### BUGGY CODE ###

k = int(input())
s = 0
import math
from functools import reduce
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      s += reduce(math.gcd, [a,b,c])
print(s)

### FIXED CODE ###

k = int(input())
s = 0
import math
from functools import reduce
for a in range(1,k+1):
  for b in range(1,k+1):
    g = math.gcd(a,b)
    for c in range(1,k+1):
      s += math.gcd(g,c)
print(s)