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

class Puzzle():
  def __init__(self, mat, h,w,k):
    self.mat = mat
    self.h = h
    self.w = w
    self.k = k
    self.score = 0

  def calc(self, t):
    tmp_score = 0

    # print("before")
    # for m in self.mat:
    #   print(m)

    for i in range(self.h):
      for j in range(self.w):
        if self.mat[i][j] > 0:
          for k in range(self.w, -1, -1):
            # if k - j < self.k: break
            if k-j >= self.k:
              s = set(self.mat[i][j:k])
              if len(s) == 1 and -1 not in s:
                tmp_score += list(s)[0] * (k-j)
                for l in range(j, k):
                  self.mat[i][l] = -1
            else:
              break

    # print("calced")
    # for m in self.mat:
    #   print(m)

    if tmp_score == 0:
      return False
    else:
      self.score += pow(2, t) * tmp_score
      if self.score == 642: import pdb; pdb.set_trace()
      return True

  def flatten(self):
    pivot_mat = []
    for i in range(self.w):
      row = []
      for j in range(self.h):
        if self.mat[j][i] != -1:
          row.append(self.mat[j][i])

      short = self.h - len(row)
      if short > 0:
        row.reverse()
        for k in range(short):
          row.append(-1)
        row.reverse()
      
      pivot_mat.append(row)

    mat = [ [-1]*self.w for i in range(self.h) ]
    for i in range(self.h):
      for j in range(self.w):
        mat[i][j] = pivot_mat[j][i]

    self.mat = mat

h,w,k = map(int,input().split())
mat = []
for _ in range(h):
  mat.append([int(e) for e in list(input())])

res = 0
for i in range(h):
  for j in range(w):
    old = mat[i][j]
    mat[i][j] = -1
    puzzle = Puzzle(mat,h,w,k)
    puzzle.flatten()
    time = 0
    while True:
      if puzzle.calc(time):
        puzzle.flatten()
        time += 1
      else:
        break
    res = max(res, puzzle.score)
    mat[i][j] = old

print(res)



### FIXED CODE ###

from itertools import groupby

def calc(time):
  t = 0
  for i in range(h):
    gr = groupby(g[i])
    lst = []
    p = 0
    for key,it in gr:
      j = len(list(it))
      lst.append([p,key,j])
      p += j
    for j in range(len(lst)):
      if lst[j][1] == -1:
        continue
      if lst[j][2] >= K:
        t += (2**time)*lst[j][1]*lst[j][2]
        for k in range(lst[j][0],lst[j][0]+lst[j][2]):
          g[i][k] = 0

  return t

def flatten():
  for j in range(w):
    lst = []
    for i in range(h-1, -1, -1):
      if g[i][j] > 0:
        lst.append(g[i][j])

    lst += [-1] * (h - len(lst))

    for i in range(h-1, -1, -1):
      g[i][j] = lst[h-i-1]

h,w,K = map(int,input().split())
mat = [ [int(e) for e in list(input())] for _ in range(h) ]

res = 0
for i in range(h):
  for j in range(w):
    score = 0
    g = [ [ mat[n][m] for m in range(w) ] for n in range(h) ]
    g[i][j] = -1
    time = 0
    flatten()
    while True:
      s = calc(time)
      if s==0: break
      score += s
      flatten()
      time += 1
    res = max(res, score)

print(res)
### BUGGY CODE ###

N, W = map(int, input().split())

def dp(N, W):
    dp = [0] * (W+1)
    
    for i in range(N):
        w, v = map(int, input().split())
        tmp = dp[:]
        for j in range(1, W+1):
            if j  >= w and tmp[j] < tmp[j-w] + v:
                dp[j] = tmp[j-w] + v
            else:
                dp[j] = tmp[j]
        
    print(dp[-1])

dp(N, W)


### FIXED CODE ###

N, W = map(int, input().split())

w, v = [0] * N, [0] * N

for i in range(N):
	w[i], v[i] = map(int, input().split())

dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(N):
	for j in range(W + 1):
		if j - w[i] >= 0:
			dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i])
		else:
		    dp[i + 1][j] = dp[i][j] 

print(dp[N][W])
### BUGGY CODE ###

[N,L] = [int(x) for x in input().split()]
A = {}
B = [0]*N
ANS = {}
count = 0
for i,x in enumerate(input().split()):
    i = int(i)
    x = int(x)
    B[i] = x
    if x in A : A[x] += [i]
    else : A[x] = [i]
for i in sorted(A) :
    for j in A[i] :
        for k in range(L) :
            if j + k not in ANS :
                ANS[j+k] = i
                count += 1
    if count > N * 0.997 : break
        
for i in range(L):
    if i not in ANS : ANS[i] = min(B[:i+1])
for i in range(L,N):
    if i not in ANS : ANS[i] = min(B[i+1-L:i+1])
for i in range(L-1,N-1) : print(ANS[i], end=" ")
print(ANS[N-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
def main():
  n,m,s=map(int,input().split())
  uvab=[list(map(int,input().split())) for _ in range(m)]
  cd=[list(map(int,input().split())) for _ in range(n)]
  g=[[]for _ in range(n)]
  for u,v,a,b in uvab:
    g[u-1].append([v-1,a,b])
    g[v-1].append([u-1,a,b])
  import heapq,math
  dp=[[math.inf]*(100*51)for _ in range(n)]
  kakutei=[[0]*(100*51)for _ in range(n)]
  dp[0][min(s,100*51-1)]=0
  todo=[[0,0,min(s,100*51-1)]] # [dp[v][i],v,i]
  heapq.heapify(todo)
  flgs=[0]*n
  flg=0
  ans=[math.inf]*n
  while flg<n:
    _,v,i=heapq.heappop(todo)
    if kakutei[v][i]==1:
      continue
    kakutei[v][i]=1
    if flgs[v]==0:
      flg+=1
      flgs[v]=1
    c,d=cd[v]
    ans[v]=min(ans[v],_)
    # 両替
    j=min(100*51-1,i+c)
    dp[v][j]=min(dp[v][j],dp[v][i]+d)
    heapq.heappush(todo,[dp[v][j],v,j])
    # 鉄道
    l=g[v]
    for u,a,b in l:
      if i-a>=0 and kakutei[u][i-a]==0:
        dp[u][i-a]=min(dp[u][i-a],dp[v][i]+b)
        heapq.heappush(todo,[dp[u][i-a],u,i-a])
  print(*ans[1:],sep='\n')
if __name__=='__main__':
  main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
  n,m,s=map(int,input().split())
  uvab=[list(map(int,input().split())) for _ in range(m)]
  cd=[list(map(int,input().split())) for _ in range(n)]
  g=[[]for _ in range(n)]
  for u,v,a,b in uvab:
    g[u-1].append((v-1,a,b))
    g[v-1].append((u-1,a,b))
  import heapq
  inf=pow(10,21)
  max_s=50*50
  dp=[[inf]*(max_s+1)for _ in range(n)]
  kakutei=[[0]*(max_s+1)for _ in range(n)]
  dp[0][min(s,max_s)]=0
  todo=[[0,0,min(s,max_s)]] # [dp[v][i],v,i]
  heapq.heapify(todo)
  flgs=[0]*n
  flg=0
  ans=[inf]*n
  while flg<n:
    _,v,i=heapq.heappop(todo)
    if kakutei[v][i]==1:
      continue
    kakutei[v][i]=1
    if flgs[v]==0:
      flg+=1
      flgs[v]=1
    c,d=cd[v]
    ans[v]=min(ans[v],_)
    # 両替
    j=min(max_s,i+c)
    if kakutei[v][j]==0:
      dp[v][j]=min(dp[v][j],dp[v][i]+d)
      heapq.heappush(todo,[dp[v][j],v,j])
    # 鉄道
    l=g[v]
    for u,a,b in l:
      if i-a>=0 and kakutei[u][i-a]==0:
        dp[u][i-a]=min(dp[u][i-a],dp[v][i]+b)
        heapq.heappush(todo,[dp[u][i-a],u,i-a])
  print(*ans[1:],sep='\n')
if __name__=='__main__':
  main()
### BUGGY CODE ###

N, X, Y = map(int, input().split())
S = [sorted(list(range(1, i+1)), reverse=True) + list(range(N-i)) for i in range(N)]

S[X-1][Y-1] = 1
S[Y-1][X-1] = 1

"""for _ in range(2):
    for k in range(X-1, Y-1):
    #for k in range(N):
        for i in range(N):
            for j in range(N):
                    S[i][j] = min(S[i][j], S[i][k]+S[k][j])"""

for i in range(N):
    for j in range(N):
        x, y = X-1, Y-1
        S[i][j] = min(S[i][j], S[i][x]+S[x][y]+S[y][j])

#print(S)

dist = [0]*N

from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
)

for i, j in combinations(list(range(N)), 2):
    d = S[i][j]
    dist[d] += 1

#print(dist)

for i in range(1, len(dist)):
    print(dist[i])

### FIXED CODE ###

N, X, Y = map(int, input().split())
S = [list(reversed(list(range(1, i+1)))) + list(range(N-i)) for i in range(N)]

S[X-1][Y-1] = 1
S[Y-1][X-1] = 1

for i in range(N):
    for j in range(N):
        x, y = X-1, Y-1
        S[i][j] = min(S[i][j], S[i][x]+1+S[y][j])

#print(S)

dist = [0]*N

from itertools import (
    accumulate,  # 累積和のイテレータ
    groupby,  # 値をkey,同じ値の集まりをgroup
    permutations,  # 順列
    combinations,  # 組み合わせ
    product,  # 重複あり順列（直積, 深いネストにも使える）
)

for i, j in combinations(list(range(N)), 2):
    d = S[i][j]
    dist[d] += 1

#print(dist)

for i in range(1, len(dist)):
    print(dist[i])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10000)
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
AB = [[int(i) - 1 for i in input().split()] for _ in range(M)]
ans = [N * (N - 1) // 2]

class UnionFind:
    def __init__(self, element_count):
        self.parent = [i for i in range(element_count)]
        self.counter = [1 for _ in range(element_count)]
    
    def root(self, index):
        p = self.parent[index]
        if index == p:
            return index
        self.parent[index] = self.root(p)
        return self.parent[index]
    
    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            self.parent[y] = x
            self.counter[x] += self.counter[y]
            self.counter[y] = 0
    
    def count(self, index):
        return self.counter[self.root(index)]

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

uf = UnionFind(N)
for a, b in AB[:0:-1]:
    if not uf.is_same(a, b):
        ans.append(ans[-1] - uf.count(a) * uf.count(b))
        uf.unite(a, b)
    else:
        ans.append(ans[-1])
for a in ans[::-1]:
    print(a)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)
input = sys.stdin.readline
N, M = [int(i) for i in input().split()]
AB = [[int(i) - 1 for i in input().split()] for _ in range(M)]
ans = [N * (N - 1) // 2]

class UnionFind:
    def __init__(self, element_count):
        self.parent = [i for i in range(element_count)]
        self.counter = [1 for _ in range(element_count)]
    
    def root(self, index):
        root = index
        while root != self.parent[root]:
            root = self.parent[root]
        while index != root:
            index, self.parent[index] = self.parent[index], root
        return root
    
    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            self.parent[y] = x
            self.counter[x] += self.counter[y]
            self.counter[y] = 0
    
    def count(self, index):
        return self.counter[self.root(index)]

    def is_same(self, x, y):
        return self.root(x) == self.root(y)

uf = UnionFind(N)
for a, b in AB[:0:-1]:
    if not uf.is_same(a, b):
        ans.append(ans[-1] - uf.count(a) * uf.count(b))
        uf.unite(a, b)
    else:
        ans.append(ans[-1])
for a in ans[::-1]:
    print(a)
### BUGGY CODE ###

import sys

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

sys.setrecursionlimit(len(s) + 100)


def count_streak(s, i, c):
    count = 0
    for j in range(i, len(s)):
        if s[j] == c:
            count += 1
        else:
            break
    return count


def dfs(s, i, k, count):
    if i == len(s):
        return count
    elif s[i] == 1:
        c = count_streak(s, i, 1)
        count += c
        return dfs(s, i + c, k, count)
    else:
        if k > 0:
            c = count_streak(s, i, 0)
            count += c
            return dfs(s, i + c, k - 1, count)
        else:
            return count


nums = []
for i in range(n):
    if i > 0 and s[i - 1] == 1:
        continue
    count = 0
    nums.append(dfs(s, i, k, count))
print(max(nums))

### FIXED CODE ###

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

streaks = []
c = s[0]
i = 1
count = 1
while True:
    if i == n:
        streaks.append(count)
        break
    if s[i] == c:
        i += 1
        count += 1
    else:
        streaks.append(count)
        c = s[i]
        i += 1
        count = 1

accs = [0]
for num in streaks:
    accs.append(accs[-1] + num)
if accs[-1] != n:
    accs.append(n)

flag = s[0] == '0'
res = []
for i in range(len(accs)):
    if flag:
        index = i + 2 * k
    else:
        index = i + 2 * k + 1
    index = min(index, len(accs) - 1)
    res.append(accs[index] - accs[i])
    flag = not flag

print(max(res))
### BUGGY CODE ###

n, m = map(int, input().split())
l, r = map(int, input().split())
tmp_l = [i for i in range(l, r + 1)]
tmp_set = set(tmp_l)
for _ in range(m - 1):
    l, r = map(int, input().split())
    tmp_l = [i for i in range(l, r + 1)]
    tmp_set = tmp_set.intersection(set(tmp_l))

print(len(tmp_set))

### FIXED CODE ###

n, m = map(int, input().split())
l_lst = [0] * m
r_lst = [0] * m
for i in range(m):
    l, r = map(int, input().split())
    l_lst[i] = l
    r_lst[i] = r

if max(l_lst) <= min(r_lst):
    print(min(r_lst) - max(l_lst) + 1)
else:
    print(0)
### BUGGY CODE ###

import sys
from itertools import product

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N, K = mi()
    x = list(mi())
    m = 10**100
    for i in range(N-K+1):
        l = x[i:i+K]
        tmp = min(abs(l[0]), abs(l[-1]))+(l[-1]-l[0])
        m = min(m, tmp)
    print(m)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from itertools import product

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N, K = mi()
    x = list(mi())
    m = 10**100
    for i in range(N-K+1):
        tmp = min(abs(x[i]), abs(x[i+K-1]))+(x[i+K-1]-x[i])
        m = min(m, tmp)
    print(m)


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

from itertools import product as pd
g=lambda x,y:(min(x,y),max(x,y))
n,k=map(int,input().split())
o=[tuple(map(int,input().split())) for _ in range(n)]

def f(a,b,c,d):
  lx,rx=g(o[a][0],o[b][0])
  dy,uy=g(o[c][1],o[d][1])
  cnt=0
  for i in o:
    if lx<=i[0]<=rx and dy<=i[1]<=uy:
      cnt+=1
  if cnt>=k:
    return (rx-lx)*(uy-dy)
  return float("inf")

v=float("inf")
for (a,c) in pd(range(n),repeat=2):
  for (b,d) in pd(range(n),repeat=2):
    v=min(v,f(a,b,c,d))
print(v)

### FIXED CODE ###

from itertools import combinations as comb
n,k=map(int,input().split())
f=lambda x,y:(min(x,y),max(x,y))
o=[tuple(map(int,input().split())) for _ in range(n)]

v=float("inf")
for (a,b) in comb(range(n),2):
  for (c,d) in comb(range(n),2):
    lx,rx=f(o[a][0],o[b][0])
    dy,uy=f(o[c][1],o[d][1])
    cnt=0
    for i in o:
      if lx<=i[0]<=rx and dy<=i[1]<=uy:
        cnt+=1
    if cnt>=k:
      v=min(v,(rx-lx)*(uy-dy))
print(v)
### BUGGY CODE ###

from collections import deque
 
A, B, K = map(int, input().split())
 
value = deque()
s = [i for i in range(A, B+1)]
 
value.extend(s[0:K])
value.extend(s[len(s)-K:len(s)])
 
num = list(set(value))
num.sort()
for i in range(len(num)):
    print(num[i])

### FIXED CODE ###

A, B, K = map(int, input().split())

value = []

if B - A < K or B <= K:
    value.extend([i for i in range(A, B+1)])
    
else:
    value.extend([i for i in range(A, A+K)])
    value.extend([i for i in range(B-K+1, B+1)])    

num = list(set(value))
num.sort()

for i in range(len(num)):
    print(num[i])
### BUGGY CODE ###

n, k = map(int, input().split())
a = [int(i) for i in input().split()]

ans = [0] * (n-k+1)

for i in range(n-k+1):
    for j in range(k):
        if j == 0:
            ans[i] = a[i+j]
        else:
            ans[i] *= a[i+j]

for i in range(len(ans)-1):
    if ans[i] < ans[i+1]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

n, k = map(int, input().split())
a = [int(i) for i in input().split()]

for i in range(n-k):
    if a[i] < a[k+i]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

from copy import deepcopy
h,w,k=map(int,input().split())
grid=[list(input()) for _ in range(h)]
def score(t):
  total=0
  for i in range(1,h):
    for j in range(w-1):
      cnt=1
      ten=int(gc[i][j])
      while gc[i][j+1]==gc[i][j]:
        cnt+=1
        j+=1
        if j==w-1:
          break
      if cnt>=k:
        total+=2**t*(ten*cnt)
        gc[i][j-cnt+1:j+1]=['0']*cnt
  return total
def upd():
  while 1:
    ok=True
    for i in range(1,h):
      for j in range(w):
        if gc[i][j]=='0' and gc[i-1][j]!='0':
          x=gc[i-1][j]
          gc[i-1][j]='0'
          gc[i][j]=x
          ok=False
    if ok:
      return
ans=0
for i in range(1,h):
  for j in range(w):
    gc=deepcopy(grid)
    gc[i][j]='0'
    t=0
    res=0
    while 1:
      upd()
      total=score(t)
      if total==0:
        break
      t+=1
      res+=total
    ans=max(ans,res)
print(ans)

### FIXED CODE ###

from copy import deepcopy
import sys
def main():
  input=sys.stdin.readline
  h,w,k=map(int,input().split())
  grid=[]
  for _ in range(h):
    s=input().rstrip()
    s=list(s)
    s=list(map(int,s))
    grid.append(s)
  def score(t):
    total=0
    for i in range(1,h):
      for j in range(w-1):
        cnt=1
        ten=gc[i][j]
        while gc[i][j+1]==gc[i][j]:
          cnt+=1
          j+=1
          if j==w-1:
            break
        if cnt>=k:
          total+=2**t*(ten*cnt)
          gc[i][j-cnt+1:j+1]=[0]*cnt
    return total
  def upd():
    while 1:
      ok=True
      for i in range(1,h):
        for j in range(w):
          if gc[i][j]==0 and gc[i-1][j]!=0:
            x=gc[i-1][j]
            gc[i-1][j]=0
            gc[i][j]=x
            ok=False
      if ok:
        return
  ans=0
  for i in range(1,h):
    for j in range(w):
      gc=deepcopy(grid)
      gc[i][j]=0
      t=0
      res=0
      while 1:
        upd()
        total=score(t)
        if total==0:
          break
        t+=1
        res+=total
      ans=max(ans,res)
  return print(ans)
if __name__=='__main__':
  main()
### BUGGY CODE ###

n = int(input())
s = list(input())
ans = 10**7
for i in range(n):
	count = 0
	a = s[:i]
	b = s[i:]
	ac = a.count("W")
	bc = b.count("E")
	count = ac + bc
	if count <= ans:
		ans = count
print(ans)

### FIXED CODE ###

n = int(input())
s = list(input())
counter = s.count("E")
ans = counter
for i in range(1,n+1):
	if s[i-1] == "W":
		counter += 1
	elif s[i-1] == "E":
		counter -= 1
	if ans >= counter:
		ans = counter
print(ans)
### BUGGY CODE ###

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

def solve():
    N = int(input())
    dicts = []
    for i in range(N):
        s = input()
        d = {}
        for moji in s:
            if not moji in d:
                d[moji] = 0
            d[moji] += 1
        dicts.append(d)

    ans = 0    
    done = set()
    for i in range(N):
        if i in done: continue
        d1 = dicts[i]
        ret = 0
        for j in range(i+1, N):
            d2 = dicts[j]
            if d1 == d2:
                done.add(j)
                ret += 1
        # ret + (ret-1) + ... + 1 を計算する
        ans += (ret+1)*ret/2 # 和の公式

    print(int(ans))



if __name__ == "__main__":
    solve()


### FIXED CODE ###

# -*- coding:utf-8 -*-
"""解説PDF
s1 = "abaaa" をソートして "aaaab" を得る。
s2 = "dddcc" をソートして "ccddd" を得る。
s3 = "baaaa" をソートして "aaaab" を得る。これはすでに一回現れているので答えに1を足す。
s4 = "cdddc" をソートして "ccddd" を得る。これはすでに一回現れているので答えに1を足す。
s5 = "aaaab" をソートして "aaaab" を得る。これはすでに二回現れているので答えに2を足す。

というふうにやる。

「これはすでにK回現れているので」は、ハッシュテーブルでやればよい

"""
def solve():
    N = int(input())
    d = {}
    for i in range(N):
        s = "".join(sorted(input()))
        if not s in d:
            d[s] = 0
        d[s] += 1

    ans = 0
    for s, value in d.items():
        if value >= 2:
            # 和の公式で答えにタス
            ans += (value-1+1)*(value-1)/2
    print(int(ans))


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

n = int(input())

a = []
a = list(map(int, input().split()))

ans = []
for i in range(n):
    ans.append(0)

for i in range(len(a)-1, -1, -1):
    k = 0
    for j in range(i, len(a), 1):
        if i > 0 and j % i == 0:
            k += ans[j]
    if a[i] != ans[j]:
        ans[i] = 1

print(ans.count(1))
for i in range(len(ans)):
    if ans[i] != 0:
        print(i+1)



### FIXED CODE ###

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

ans = []
for i in range(n):
    if i < n//2:
        ans.append(0)
    else:
        ans.append(a[i])

for i in range(n//2-1, -1, -1):
    ans[i] = (a[i] + sum(ans[i::i+1])) % 2

print(ans.count(1))
for i in range(n):
    if ans[i] != 0:
        print(i+1, "", end="")
### BUGGY CODE ###

from collections import defaultdict
def solve():
	Base = 2000
	MAX = Base*2
	p = 10**9+7
	F = [1]; Finv = [0]*(MAX*2+1)
	for i in xrange(MAX*2): F.append(F[i]*(i+1)%p)
	Finv[MAX] = pow(F[MAX],p-2,p)
	for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p
	N = int(raw_input())
	dup = A_MAX = B_MAX = 0
	dp = [[0]*(MAX+2) for i in xrange(MAX+2)]
	goals = defaultdict(int)
	for i in xrange(N):
		A,B = map(int,raw_input().split())
		dup = (dup + F[A*2+B*2]*Finv[A*2]*Finv[B*2])%p
		if A > A_MAX: A_MAX = A
		if B > B_MAX: B_MAX = B
		goals[(Base+A,Base+B)] += 1
		dp[Base-B][Base-A] += 1
	for j in xrange(Base-B_MAX,Base+B_MAX+1):
		for i in xrange(Base-A_MAX,Base+A_MAX+1):
			dp[j+1][i] = (dp[j+1][i] + dp[j][i]) % p
			dp[j][i+1] = (dp[j][i+1] + dp[j][i]) % p
	ans = 0
	for (i,j),v in goals.iteritems():
		ans = (ans + dp[j][i]*v) % p
	print (ans - dup + p)*pow(2,p-2,p) % p
solve()

### FIXED CODE ###

from collections import defaultdict
def solve():
	Base = 2000
	MAX = Base*2
	p = 10**9+7
	F = [1]; Finv = [0]*(MAX*2+1)
	for i in xrange(MAX*2): F.append(F[i]*(i+1)%p)
	Finv[MAX] = pow(F[MAX],p-2,p)
	for i in xrange(MAX,0,-1): Finv[i-1] = Finv[i]*i%p
	N = int(raw_input())
	dup = A_MAX = B_MAX = 0
	dp = [[0]*(MAX+2) for i in xrange(MAX+2)]
	goals = defaultdict(int)
	for i in xrange(N):
		A,B = map(int,raw_input().split())
		dup = (dup + F[A*2+B*2]*Finv[A*2]*Finv[B*2])%p
		if A > A_MAX: A_MAX = A
		if B > B_MAX: B_MAX = B
		goals[(Base+A,Base+B)] += 1
		dp[Base-B][Base-A] += 1
	for j in xrange(Base-B_MAX,Base+B_MAX+1):
		for i in xrange(Base-A_MAX,Base+A_MAX+1):
			dp[j+1][i] = (dp[j+1][i] + dp[j][i]) % p
			dp[j][i+1] = (dp[j][i+1] + dp[j][i]) % p
	ans = 0
	for (i,j),v in goals.iteritems():
		ans = (ans + dp[j][i]*v) % p
	print ((ans - dup)*pow(2,p-2,p)+p) % p
solve()
### BUGGY CODE ###

from sys import stdin


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = [int(x) for x in stdin.readline().rstrip().split()]
    As.sort()
    for _ in range(M):
        As[-1] /= 2
        As.sort()
    print(sum([int(x) for x in As]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin
import heapq


def main():
    N, M = [int(x) for x in stdin.readline().rstrip().split()]
    As = []
    for i in [int(x) for x in stdin.readline().rstrip().split()]:
        heapq.heappush(As, -i)
    for _ in range(M):
        x = heapq.heappop(As)
        heapq.heappush(As, x / 2)
    print(sum([-1 * int(x) for x in As]))


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

from numpy import*
M=10**9+7
m=lambda*z:map(int,raw_input().split())
n,k=m()
b=[1]*n
a=matrix(map(m,b),'O')
while k:b*=[1,a][k&1];a*=a%M;k/=2
print sum(b)%M

### FIXED CODE ###

import numpy
M=10**9+7
n,k=map(int,input().split())
a=numpy.matrix([list(map(int,input().split()))for i in[0]*n],dtype='O')
b=numpy.eye(n,dtype='O')
while k:
 if k&1:b=b*a%M
 a=a*a%M
 k>>=1
print(b.sum()%M)
### BUGGY CODE ###

k = int(input())
if k == 2 or k == 5:
  print(-1)
else:
  a = 7
  cnt = 1
  while True:
    if a % k == 0:
      print(cnt)
      break
    a = a * 10 + 7
    cnt += 1

### FIXED CODE ###

k = int(input())
if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  state = 7
  state %= k
  cnt = 1
  while True:
    if state == 0:
      print(cnt)
      break
    state = state * 10 + 7
    state %= k
    cnt += 1