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

import sys

N = int(sys.stdin.readline().rstrip())
S = sys.stdin.readline().rstrip()

if len(set(S)) == 1 or N < 3:
    print(0)
    sys.exit()

ans = []
for i in range(N - 2):
    a = S[i]
    for j in range(i + 1, N - 1):
        b = S[j]
        if a == b:
            continue
        jtoi = j - i
        for k in range(j + 1, N):
            c = S[k]
            if a == c or b == c:
                continue
            ktoj = k - j
            if jtoi != ktoj:
                ans.append(None)

print(len(ans))

### FIXED CODE ###

import sys

N = int(sys.stdin.readline().rstrip())
S = sys.stdin.readline().rstrip()

if len(set(S)) == 1 or N < 3:
    print(0)
    sys.exit()

Rs = S.count("R")
Gs = S.count("G")
Bs = S.count("B")
ans = Rs * Gs * Bs


for i in range(N - 1):
    for j in range(i + 1, N):
        k = j + (j - i)
        if k >= N: break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            ans -= 1
print(ans)
### BUGGY CODE ###

N,M = list(map(int,input().split()))

e_list = [[] for i in range(N)]
es = []
for i in range(M):
    a,b = list(map(int,input().split()))
    a,b = a-1,b-1
    es.append((a,b))
    e_list[a].append((b,1))

import heapq
flag=False
min_d = 10**27
for vg,vi in es:
    #dijkstra
    #you need to prepare e_list = [[orient,dist]]
    
    min_d_list = [10**27 for i in range(N)]
    min_d_list[vi] = 0
    prev_list = [-1 for i in range(N)]
    q = []
    for i in range(N):
        heapq.heappush(q,[min_d_list[i],i])
    
    while len(q)>0:
        d,v = heapq.heappop(q)
        for e in e_list[v]:
            v1,d1=e
            if v!=vg or v1!=vi:
                if min_d_list[v1]>d+d1:
                    min_d_list[v1]=d+d1
                    prev_list[v1]=v
                    heapq.heappush(q,[d+d1,v1])
    if min_d_list[vg]<min_d:
        flag=True
        min_vi = vi
        min_vg = vg
        min_d = min_d_list[vg]
        min_prev = prev_list
            
#print(min_d_list)
if flag:
    ans = []
    v = min_vg
    while v!=min_vi:
        ans.append(v+1)
        v=min_prev[v]
    ans.append(min_vi+1)
    ans = ans[::-1]
    
    print(len(ans))
    for a in ans:
        print(a)
else:
    print(-1)

### FIXED CODE ###

N,M = list(map(int,input().split()))

e_list = [[] for i in range(N)]
es = []
for i in range(M):
    a,b = list(map(int,input().split()))
    a,b = a-1,b-1
    es.append((a,b))
    e_list[a].append(b)

from collections import deque
flag=False
min_d = 10**27
for vg,vi in es:
    Q = deque([vi])
    checked_list = [False for i in range(N)]
    checked_list[vi]=True
    min_path_list = [10**27 for i in range(N)] #問題によりここを変える
    min_path_list[vi] = 0
    prev_list = [-1]*N
    while len(Q)>0:
        v = Q.pop()
        for v1 in e_list[v]:
            if v!=vg or v1!=vi:
                if not checked_list[v1]:
                    checked_list[v1]=True
                    Q.appendleft(v1)
                    prev_list[v1]=v
                    min_path_list[v1]=min(min_path_list[v1],min_path_list[v]+1) #問題によりここを変える
    if min_path_list[vg]<min_d:
        flag=True
        min_vi = vi
        min_vg = vg
        min_d = min_path_list[vg]
        min_prev = prev_list
            
#print(min_d_list)
if flag:
    ans = []
    v = min_vg
    while v!=min_vi:
        ans.append(v+1)
        v=min_prev[v]
    ans.append(min_vi+1)
    ans = ans[::-1]
    
    print(len(ans))
    for a in ans:
        print(a)
else:
    print(-1)
### BUGGY CODE ###

from collections import deque
H, W = map(int, input().split())
field = ''
for i in range(H):
    field += input()
field += '#' * W

def bfs(s):
    noreach = [1] * (H * W)
    for _ in range(W):
        noreach.append(0)
    q = deque()
    q.append((s, 0))
    while q:
        p, c = q.popleft()
        noreach[p] = 0
        if (field[p - W] == '.') and noreach[p - W]:
            q.append((p - W, c + 1))
        if (field[p + W] == '.') and noreach[p + W]:
            q.append((p + W, c + 1))
        if (field[p - 1] == '.') and noreach[p - 1] and p % W != 0:
            q.append((p - 1, c + 1))
        if (field[p + 1] == '.') and noreach[p + 1] and p % W != W - 1:
            q.append((p + 1, c + 1))
    return c

ans = -1
for s in range(H * W):
    if field[s] == '.':
        ans = max(ans, bfs(s))
print(ans)


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
field = ''
for i in range(H):
    field += input()

def bfs(start):
    dist = [0] * (H * W)
    q = deque([start])
    while q:
        p = q.popleft()
        c = dist[p] + 1
        if p - W != start and p - W >= 0 and field[p - W] == '.' and dist[p - W] == 0:
            dist[p - W] = c
            q.append(p - W)
        if p + W != start and p + W < H * W and field[p + W] == '.' and dist[p + W] == 0:
            dist[p + W] = c
            q.append(p + W)
        if p - 1 != start and p - 1 >= 0 and field[p - 1] == '.' and dist[p - 1] == 0 and p % W != 0:
            dist[p - 1] = c
            q.append(p - 1)
        if p + 1 != start and p + 1 < H * W and field[p + 1] == '.' and dist[p + 1] == 0 and p % W != W - 1:
            dist[p + 1] = c
            q.append(p + 1)
    return dist[p]

ans = 0
for s in range(H * W):
    if field[s] == '.':
        ans = max(ans, bfs(s))
print(ans)
### BUGGY CODE ###

n = int(input())
a = 1
ans = 0

while a < n:
    b = 1
    while a * b < n:
        ans += 1
        b += 1
    a += 1

print(ans)

### FIXED CODE ###

n = int(input())
a = 2
ans = 0
 
while a < n/2:
    b = 2
    while a * b < n:
        ans += 1
        b += 1
    a += 1
 
print(ans+2*(n-2)+1)
### BUGGY CODE ###

n, m = map(int, input().split())
if m % n == 0:
    print(m // n)
    exit()
ret = 1
i = 1
while(n * i <= m):
    if m % i == 0:
        ret = i
    i += 1
print(ret)

### FIXED CODE ###

n, m = map(int, input().split())
divisors = []
for i in range(1,m+1):
    if i * i > m:
        break
    if i * i == m:
        divisors.append(i)
        break
    if m % i == 0:
        divisors.append(i)
        divisors.append(m // i)
ans = filter(lambda d: d <= m//n, divisors)
print(max(ans))
### BUGGY CODE ###

import heapq as hq
def main():
    s = int(input())
    if s ==1:
        print(0,0,0,1,1,0)
        exit()
    else:
        prime = [2] + [i for i in range(3,s+1,2)]
        prime_number = []
        x = 1
        y = 1
        for i in prime:
            if i <= s**0.5:
                prime = [x for x in prime if (x == i or x%i != 0)]
            else:
                break
        for i in prime:
            while not s%i:
                prime_number.append(i)
                s /= i
        for i in range(len(prime_number)):
            if i%2:
                x *= prime_number[i]
            else:
                y *= prime_number[i]
        print(0,0,x,0,0,y)
if __name__ == '__main__':
    main()

### FIXED CODE ###

S=int(input())
if S<10**18:
    x1,y1,x2,y2,x3,y3=0,0,(S//10**9+1),10**9-S%10**9,1,10**9
else:
    x1,y1,x2,y2,x3,y3=(0,0,10**9,1,0,10**9)
print(x1,y1,x2,y2,x3,y3)
### BUGGY CODE ###

from collections import deque

def bfs(grid, queue, wall, vis, hw):
    ans = 0
    dxy = [(1,0), (-1,0), (0,1), (0,-1)]
    while queue and vis < hw:
        cnt,y,x = queue.popleft()
        for dy, dx in dxy:
            y_,x_ = y+dy,x+dx
            if grid[y_][x_] == wall:
                continue
            queue.append([cnt+1,y_,x_])
            grid[y_][x_] = wall
            ans = max(ans, cnt+1)
            vis += 1
    return ans

H,W = map(int, input().split())
wall = '#'
queue = deque([])
edges = [wall for i in range(W+2)]
grid = [edges]
cnt = 0

for i in range(1,H+1):
    S = [wall]+list(input().strip())+[wall]
    for j in range(1,W+1):
        if S[j] == wall:
            queue.append([0,i,j])
            cnt += 1
    grid.append(S)
grid.append(edges)
print(bfs(grid, queue, wall, cnt, H*W))


### FIXED CODE ###

from collections import deque

def bfs(grid, queue, wall):
    ans = 0
    dxy = [(1,0), (-1,0), (0,1), (0,-1)]
    while queue:
        cnt,y,x = queue.popleft()
        for dy, dx in dxy:
            y_,x_ = y+dy,x+dx
            if grid[y_][x_] == wall:
                continue
            queue.append([cnt+1,y_,x_])
            grid[y_][x_] = wall
            ans = max(ans, cnt+1)
    return ans

H,W = map(int, input().split())
wall = '#'
queue = deque([])
edges = [wall for i in range(W+2)]
grid = [edges]

for i in range(1,H+1):
    S = [wall]+list(input().strip())+[wall]
    for j in range(1,W+1):
        if S[j] == wall:
            queue.append([0,i,j])
    grid.append(S)
grid.append(edges)
print(bfs(grid, queue, wall))
### BUGGY CODE ###

num = int(input())

arr = [i for i in range(1,num+1)]

print(sum(arr[:-1]))

### FIXED CODE ###

num = int(input())
     
print(int(num*(num-1)//2))
### BUGGY CODE ###

N = int(input())
A = []
for i in range(N):
    A.append( [ int(n) for n in input().split() ] )

empty = [ [] for i in range(N) ]
day = 0
while(True):
    day += 1
    v = list(range(N))
    for p in range(N):
        if (not p in v) or len(A[p]) == 0:
            continue
        q = A[p][0]-1
        if p in v  and  q in v  and  A[q][0]-1 == p:
            v.remove(p)
            v.remove(q)
            del A[p][0]
            del A[q][0]
        
    if A == empty:
        print(day)
        break
        
    if len(v) == N:
        print(-1)
        break

### FIXED CODE ###

# match of  a vs b
def match(a, b):
    """
    :type a: int
    :type b: int
    :rtype: int
    """
    return min(a,b) + N * max(a,b)

N = int(input())
A = []
for i in range(N):
    A.append( [ int(n)-1 for n in input().split() ] )

# NEXT[ match(a,b) ]  must be held after  match(a,b)
NEXT = [ [] for i in range(N*N) ]
# How many matches must be held before  match(a,b)
before = [ 0 for i in range(N*N) ]

for i in range(N):
    for j in range(N-2):
        # i vs A[i][j+1]  must be held after  i vs A[i][j]
        NEXT[ match(i,A[i][j]) ].append( match(i,A[i][j+1]) )
        before[ match(i,A[i][j+1]) ] += 1
        
q  = []
q0 = []

for i in range(N):
    for j in range(i+1,N):
        if before[ match(i,j) ] == 0:
            q.append( match(i,j) )
            
day = 0

while True:
    day += 1
    for M in q:
        for m in NEXT[M]:
            before[m] -= 1
            if before[m] == 0:
                q0.append(m)
        NEXT[M] = []
    q = q0
    q0 = []
    #print(NEXT)
    #print(before)
    if q == []:
        break

if NEXT == [ [] for i in range(N*N) ]:
    print(day)
else:
    print(-1)
### BUGGY CODE ###

n, q = list(map(int, input().split()))
s = input()
lr = []
for i in range(q):
  lr.append(list(map(int, input().split())))
  str_a = s[(lr[i][0] - 1):(lr[i][1])].replace('AC', '+')
  print(str_a.count('+')) 

### FIXED CODE ###

n, q = list(map(int, input().split()))
s = input()
cnt = 0
word_list = []
for i in range(n):
  if i > 0:
    if(s[i - 1] == 'A') and (s[i] == 'C') : cnt += 1 
  word_list.append(cnt)
for i in range(q):
  l, r = list(map(int, input().split()))
  print(word_list[r - 1] - word_list[l - 1])
### BUGGY CODE ###

import math
import numpy as np

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

dic = {} #ここに結果を保存していく。
ans = 0
moddo = 10**9+7

for i in range(k):
    t = k - i #これで大きいほうから順にとる。
    if t > k/2:
        dic[t] = 1
        ans += t
    else:
        temp = math.floor(k/t)**n
        #print(temp)
        fac = 2
        while fac*t <= k:
            temp -= dic[fac*t]
            fac += 1
        dic[t] = temp
        ans = (ans+((temp*t)%moddo))%moddo

#for i in range(1,k+1):
#    ans += i*dic[i]
#    if ans >= moddo:
#        ans = ans%moddo
    
        
#print(dic)
#print(sum(dic.values()))
print(ans)

### FIXED CODE ###

import math

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

dic = {} #ここに結果を保存していく。
ans = 0
moddo = 10**9+7

for i in range(k):
    t = k - i #これで大きいほうから順にとる。
    if t > k/2: #tがk/2より大きいときはすべてtじゃないと最大公約数はtにならない。
        dic[t] = 1
        ans += t
    else:
        temp = pow(k//t,n,moddo)
        #print(temp)
        fac = 2
        while fac*t <= k:
            temp -= dic[fac*t]
            fac += 1
        dic[t] = temp%moddo
        ans = (ans+((temp*t)%moddo))%moddo

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

# -*- coding: utf-8 -*-
"""
Created on Sat Feb 22 22:30:30 2020

@author: matha
"""

#global


def dp(pos, cw):
    if pos>= N or cw > W:
        return 0;
    temp = mem.get((pos, cw), None)
    if temp:
        return temp
    
    w = rec[pos][0]
    
    v1 = 0
    v2 = 0
    
    if(cw+w <= W):
        v1 = rec[pos][1]
        v1 += dp(pos+1, cw + w)
    
    v2 = dp(pos+1, cw)
    
    if(v1>v2):
        mem[(pos, cw)] = v1
        return v1
    else:
        mem[(pos, cw)] = v2
        return v2

rec = []
mem = {}

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

for i in range(N):
    w, v = input().split()
    w = int(w)
    v = int(v)
    
    rec.append( (w, v))
    

print(dp(0, 0))
    
    



### FIXED CODE ###

ln = input()
n, cap = ln.split()
n = int(n)
cap = int(cap)

'''
weights = [[0 for x in range(2)] for y in range(n)] 
values = [[0 for x in range(2)] for y in range(n)] 
mat = [[0 for x in range(2)] for y in range(1000000)] 
'''
weights = [0 for x in range(n)] 
values =  [0 for x in range(n)] 
mat =  [0 for x in range(1000000)] 

for i in range(n):
    ln = input()
    ln = ln.split()
    weights[i] = int(ln[0])
    values[i] = int(ln[1])
 
for i in range(n):
    for j in range(cap,weights[i]-1,-1):
        '''
        print(j)
        print(values[i])
        print(mat[j-weights[i]])
        '''
        mat[j] = max(mat[j], mat[j-weights[i]] + values[i])
 
        
print(mat[cap])
### BUGGY CODE ###

n = int(input())
a = input().split(" ")
a = [int(i) for i in a]

m = max(a)
r = -1

for i in range(len(a)):
  t = i + 1
  try:
    idx = a.index(t)
    a = a[(idx+1):]
    a = [i for i in a if i != t]
    r = t
  except:
    break

if r < 0:
  print(r)
else:
  print(n - r)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
 
target = 1
ans = 0
 
for i in range(N):
    if a[i] == target:
        target += 1
    else:
        ans += 1
 
if ans == N:
    ans = -1
    
print(ans)
### BUGGY CODE ###

import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, k = na()
h = na()

inf = 1 << 60
dp = [inf for i in range(n)]
dp[0] = 0

for i in range(n):
    p = min(i + k + 1, n)
    for j in range(i + 1, p):
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))
print(dp[n - 1])

### FIXED CODE ###

import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, k = na()
h = na()

inf = 1 << 60
dp = [inf for i in range(n)]
dp[0] = 0

for i in range(n):
    p = min(i + k + 1, n)
    for j in range(i + 1, p):
        dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]))
print(dp[n - 1])
### BUGGY CODE ###

import numpy as np
N = int(input())
temp = input()
a = np.array([int(i) for i in temp.split()])

num_X = 0

for max_new in range(max(a)+2):
    X_new = 0
    X_new += sum([ 1 for ele in a if ele == max_new ])
    X_new += sum([ 1 for ele in a-1 if ele == max_new ])
    X_new += sum([ 1 for ele in a+1 if ele == max_new ])
    num_X = max(num_X, X_new)
    
print(num_X)

### FIXED CODE ###

import numpy as np
N = int(input())
temp = input()
a = np.array([int(i) for i in temp.split()])

list_X = [0]*1000000

for ele in a:
    list_X[ele] += 1
    list_X[ele-1] += 1
    list_X[ele+1] += 1

print(max(list_X))
### BUGGY CODE ###

import math
from functools import reduce

k = int(input())

wa = 0

for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            li = [a,b,c]
            wa += reduce(math.gcd,li)

print(wa)



### FIXED CODE ###

import math
from functools import reduce
import sys
sys.setrecursionlimit(2000000)

k = int(input())

wa = 0

for a in range(1,k+1):
    for b in range(a+1,k+1):
        for c in range(b+1,k+1):
            li = [a,b,c]
            wa += reduce(math.gcd,li)*6

for a in range(1,k+1):
    for b in range(a+1,k+1):
        wa += math.gcd(a,b)*6

for a in range(1,k+1):
    wa += a
    

print(wa)
### BUGGY CODE ###

def myAnswer(S:list) -> int:
   counter = 0
   while True:
      for i in range(len(S)-1):
         if(S[i]!=S[i+1]):
            S.pop(i)
            S.pop(i)
            counter += 2
            break
      else:
         break
   return counter

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S[:]))
if __name__ == '__main__':
   main()

### FIXED CODE ###

def myAnswer(S:list) -> int:
   C0 = 0
   C1 = 0
   for s in S:
      if(s =="0"):
         C0+=1
      else:
         C1 += 1
   return 2*min(C0,C1)

def modelAnswer():
   tmp=1
def main():
   S = list(input())
   print(myAnswer(S[:]))
if __name__ == '__main__':
   main()
### BUGGY CODE ###

n = int(input())
s = input()
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            p = [i, j, k]
            idx = 0
            for l in range(n):
                if int(s[l]) == p[idx]:
                    idx += 1
                if idx == 3:
                    break
            if idx == 3:
                ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
s = input()
a = [set(), set(), set()]
for i in range(n):
    for j in a[1]:
        a[2].add(j + s[i])
    for j in a[0]:
        a[1].add(j + s[i])
    a[0].add(s[i])
print(len(a[2]))
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
ans=[]
for i in range(q):
	x,y=map(int,input().split())
	ans.append(s[x-1:y].count('AC'))
print('\n'.join(list(map(str,ans))))
	

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
t=[0]*(n+1)
for i in range(n):
	t[i+1]=t[i]+(1 if s[i:i+2]=='AC' else 0)
for i in range(q):
	l,r=map(int,input().split())
	print(t[r-1]-t[l-1])
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
p,q=0,1
for i in range(n):
    if i+1 in a:p,q=q,0
    else:p,q=q,p+q
print(q%1000000007) 

### FIXED CODE ###

n,m=map(int,input().split())
a=[1]*(n+1)
for _ in range(m):a[int(input())]=0
p,q=0,1
for i in range(1,n+1):
    p,q=q,a[i]*(p+q)%(10**9+7)
print(q)
### BUGGY CODE ###

N,Q = map(int, input().split())
L = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
cnt = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p-1] += x


flag = [-1]*N
q = [0]
flag[0] = 1
while q:
    temp = q.pop(0)
    for i in L[temp]:
        if flag[i] < 0:
            q.append(i)
            cnt[i] += cnt[temp]
            flag[i] = 1
            
for i in range(N):
    print(cnt[i])

### FIXED CODE ###

N,Q = map(int, input().split())
L = [[] for _ in range(N)]
for _ in range(N-1):
    a, b = map(int, input().split())
    L[a-1].append(b-1)
    L[b-1].append(a-1)
cnt = [0]*N
for _ in range(Q):
    p, x = map(int, input().split())
    cnt[p-1] += x

flag = [1]*N
q = [0]
while q:
    temp = q.pop()
    flag[temp] = 0
    for i in L[temp]:
        if flag[i]:
            q.append(i)
            cnt[i] += cnt[temp]
            
print(*cnt)
### BUGGY CODE ###

#!/usr/bin/env python:
# -*- coding: utf-8 -*-

import sys

def make_prime_list(lim):
    lst = [True for i in xrange(lim + 1)]

    num = 2
    while num ** 2 <= lim:
        for i in xrange(num * 2, lim + 1, num):
            lst[i] = False
        num += 1
        while not lst[num]:
            num += 1
    return [i for i in xrange(2, lim + 1) if lst[i]]

def solve():
    prime_list = make_prime_list(50000)
    while True:
        n = input()
        if n > 0:
            count = 0
            index = 0
            rev_index = len(prime_list) - 1
            while index <= rev_index:
                while prime_list[index] + prime_list[rev_index] > n:
                    rev_index -= 1
                if prime_list[index] + prime_list[rev_index] == n:
                    count += 1
                index += 1
            print count
        else:
            sys.exit()

if __name__ == "__main__":
    solve()
    

### FIXED CODE ###

#!/usr/bin/env python:
# -*- coding: utf-8 -*-

import sys

def make_prime_list(lim):
    lst = [True for i in xrange(lim + 1)]

    num = 2
    while num ** 2 <= lim:
        for i in xrange(num * 2, lim + 1, num):
            lst[i] = False
        num += 1
        while not lst[num]:
            num += 1
    return [i for i in xrange(2, lim + 1) if lst[i]]

def binary_search(n, prime_list):
    rLim = len(prime_list) - 1
    lLim = 0
    while lLim < rLim:
        middle = (rLim + lLim) / 2
        if prime_list[middle] == n:
            return middle
        elif prime_list[middle] < n:
            lLim = middle + 1
        else:
            rLim = middle - 1
    while prime_list[rLim] < n and rLim < len(prime_list) - 1:
        rLim += 1
    return rLim    

def solve():
    prime_list = make_prime_list(50000)
    while True:
        n = input()
        if n > 0:
            if n % 2 == 0:
                count = 0
                index = 0
                rev_index = binary_search(n, prime_list)
                while index <= rev_index:
                    while prime_list[index] + prime_list[rev_index] > n:
                        rev_index -= 1
                    if index <= rev_index and prime_list[index] + prime_list[rev_index] == n:
                        count += 1
                    index += 1
                print count
            else:
                if n - 2 in prime_list:
                    print 1
                else:
                    print 0
        else:
            sys.exit()

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

import sys
input = sys.stdin.readline

# D - Friends
def append_(A, B):
  global people

  people.setdefault(A, [])
  people[A].append(B)


def create_new_group(p):
  global groups

  group = set()
  group.add(p)

  groups.append(group)


def exists_friend(i, group):
  global friends

  for p in group:
    if i in friends[p]:
      return True


N, M = map(int, input().split())
people = dict()

for i in range(M):
  A, B = map(int, input().split())
  append_(A, B)
  append_(B, A)

friends = dict()

for i in range(1, N + 1):
  friends[i] = set()

for k in people:
  for v in people[k]:
    friends[k].add(v)

    for f in people[v]:
      friends[k].add(f)

groups = []
create_new_group(1)

for i in range(2, N + 1):
  is_added = False

  for group in groups:
    if not exists_friend(i, group):
      group.add(i)
      is_added = True
      break

  if not is_added:
    create_new_group(i)

print(len(groups))

#for g in groups:
  #print(g)

### FIXED CODE ###

# D - Friends
def add_to_graph(A, B):
  global graph

  graph.setdefault(A, [])
  graph[A].append(B)


def add_to_group(p):
  global que
  global group
  global is_finished

  que.append(p)
  group.add(p)
  is_finished[p] = True


from collections import deque

N, M = map(int, input().split())
graph = dict()

for i in range(M):
  A, B = map(int, input().split())
  add_to_graph(A, B)
  add_to_graph(B, A)

# その人を探索したかどうかのフラグ
is_finished = [False] * (N + 1)
groups = []

for i in range(1, N + 1):
  que = deque()
  group = set()

  if not is_finished[i]:
    add_to_group(i)

    while len(que) > 0:
      p = que.popleft()
  
      if p in graph.keys():
        for v in graph[p]:
          if not is_finished[v]:
            add_to_group(v)
    
      groups.append(group)

ans = 0

for g in groups:
  ans = max(ans, len(g))

print(ans)