Harryxun/stf_run huggingface dataset:
N = int(input())
lst_a = [int(input()) for _ in range(N)]
lst_ans = [0] * (10**5 + 2)
lst_a.sort()


for a in lst_a:
    lst_ans[a] += 1
ans = sum(1 for i in lst_ans if i % 2 == 1)


print(ans)

### FIXED CODE ###

from collections import Counter


N = int(input())
lst_number = [int(input()) for _ in range(N)]
set_number = set(lst_number)
cnt_number = Counter(lst_number)
ans = 0


for key in set_number:
    if cnt_number[key] % 2 == 1:
        ans += 1


print(ans)
#N = int(input())
N, M =  map(int,input().split())
#W =list(map(int,input().split()))
a = [(int(input())) for i in range(M)]

memo  =[0]*1000000
def stair_count(n):
    if memo[n]!= 0:
        return memo[n]
    if n==0 or n==1:
        memo[n] =1
        return memo[n]
    memo[n] = stair_count(n-1) + stair_count(n-2)
    return memo[n]

start = 0
answer = 1
for i in a:
    #print("i={}".format(i))
        if i == start:
            print(0)
            exit()
        else:
            n = i-1-start
            answer = (answer * stair_count(n))
            start = i+1
n = N -start
answer = (answer * stair_count(n))
    #print("answer={}".format(answer))
print(answer%1000000007)


### FIXED CODE ###

#N = int(input())
N, M =  map(int,input().split())
#W =list(map(int,input().split()))
a = [(int(input())) for i in range(M)]

import sys

sys.setrecursionlimit(100000)
memo  =[-1]*(N+2)
def stair_count(n):
    if memo[n]!= -1:
        return memo[n]
    if n==0 or n==1:
        memo[n] =1
        return memo[n]
    memo[n] = stair_count(n-1) + stair_count(n-2)
    return memo[n]

start = 0
answer = 1
for i in a:
        if i == start:
            print(0)
            exit()
        else:
            n = i-1-start
            answer = (answer * stair_count(n))
            start = i+1
n = N -start
answer = (answer * stair_count(n))
print(answer%1000000007)
import sys
sys.setrecursionlimit(10 ** 9)

import functools
@functools.lru_cache(maxsize = None)

def main():
    #input
    H, W = map(int, input().split())
    lst = [['#'] * (W + 2)]
    lst += [['#'] + list(input()) + ['#'] for _ in range(H)]
    lst += [['#'] * (W + 2)]

    u_table = [[-1] * (W + 2) for _ in range(W + 2)]
    d_table = [[-1] * (W + 2) for _ in range(W + 2)]
    r_table = [[-1] * (W + 2) for _ in range(W + 2)]
    l_table = [[-1] * (W + 2) for _ in range(W + 2)]

    def u(i, j): #up方向に何マス光が伸びるかを数える
        if u_table[i][j] != -1:
            return u_table[i][j]
        if lst[i][j] == '#':
            u_table[i][j] = 0
            return 0
        else:
            u_table[i][j] = u(i - 1, j) + 1
            return u_table[i][j]
    
    def d(i, j):
        if d_table[i][j] != -1:
            return d_table[i][j]
        if lst[i][j] == '#':
            d_table[i][j] = 0
            return 0
        else:
            d_table[i][j] = d(i + 1, j) + 1
            return d_table[i][j]
    
    def r(i, j):
        if r_table[i][j] != -1:
            return r_table[i][j]
        if lst[i][j] == '#':
            r_table[i][j] = 0
            return 0
        else:
            r_table[i][j] = r(i, j + 1) + 1
            return r_table[i][j]

    def l(i, j):
        if l_table[i][j] != -1:
            return l_table[i][j]
        if lst[i][j] == '#':
            l_table[i][j] = 0
            return 0
        else:
            l_table[i][j] = l(i, j - 1) + 1
            return l_table[i][j]

    #スタートマスを変えながら最大の範囲の広さを検索
    ans = 0
    for i in range(1, H + 1):
        for j in range(1, W + 1):
            if lst[i][j] == '.': #光源を置く場所が障害物でないとき
                tmp = u(i, j) + d(i, j) + r(i, j) + l(i, j) - 3
                # print ('(i, j) = ', i, j, tmp)
                ans = max(ans, tmp)
    print (ans)
    return 

if __name__ == '__main__':
    main()



### FIXED CODE ###

#上下方向の探索と左右方向の探索をまとめる
#まず表を完成させる-->全マスの探索
H, W = map(int, input().split())
lst = [['#'] * (W+2)]
lst += [['#'] + list(input()) + ['#'] for i in range(H)]
lst += [['#'] * (W+2)]


lst_ue = [[0] * (W+2) for i in range(H+2)]
lst_shita = [[0] * (W+2) for i in range(H+2)]
lst_migi = [[0] * (W+2) for i in range(H+2)]
lst_hidari = [[0] * (W+2) for i in range(H+2)]

for i in range(1, H+1):
    for j in range(1, W+1):
        lst_hidari[i][j] = 0 if lst[i][j] == '#' else 1 + lst_hidari[i][j-1]
    for j in range(W, 0, -1):
        lst_migi[i][j] = 0 if lst[i][j] == '#' else 1 + lst_migi[i][j+1]

for j in range(1, W+1):
    for i in range(1, H+1):
        lst_ue[i][j] = 0 if lst[i][j] == '#' else 1 + lst_ue[i-1][j]
    for i in range(H+1, 0, -1):
        lst_shita[i][j] = 0 if lst[i][j] == '#' else 1 + lst_shita[i+1][j]

ans = 0
for i in range(1,H+1):
    for j in range(1, W+1):
        ans = max(ans, lst_ue[i][j]+lst_shita[i][j]+lst_migi[i][j]+lst_hidari[i][j]-3)

print (ans)
import sys
sys.setrecursionlimit(1000000)
N, M = map(int, input().split())
G = {k: [] for k in range(N)}
for _ in range(N):
    a, b = map(int, input().split())
    # 無向グラフ
    G[a-1].append(b-1)
    G[b-1].append(a-1)

visited = [False]*N
visited[0] = True


def dfs(v):
    if all(visited):
        return 1
    r = 0
    for nv in G[v]:
        if visited[nv] is False:
            visited[nv] = True
            r += dfs(nv)
            visited[nv] = False
    return r


print(dfs(0))


### FIXED CODE ###

import itertools

N,M=map(int,input().split())
route=[list(map(int,input().split())) for _ in range(M)]
candidate=list(itertools.permutations(range(1,N+1)))

ans=0
for c in candidate:
  if c[0]==1:
    for i in range(N-1):
      l=sorted([c[i], c[i+1]])
      if l not in route:
         break
    else:
      ans+=1
print(ans)
n,k = map(int,input().split())
blue = k
red = n-k

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

for i in range(1,k+1):
    ans = cmb(blue - 1 ,i-1) * cmb (red + 1 , i)
    print(ans % (10**9 + 7))



### FIXED CODE ###

n,k = map(int,input().split())
blue = k
red = n-k

def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for i in range(1,k+1):
    if red < i-1 :
        ans = 0
    else:
        ans = int( cmb(blue - 1 ,i-1)* cmb (red + 1 , i))
    print(ans % (10**9 + 7))
S = input()
if S == "Sunny":
    print("Cloudy")
elif S == Cloudy:
    print("Rainy")
else:
    print("Sunny")

### FIXED CODE ###

S = input()
if S == "Sunny":
    print("Cloudy")
elif S == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
n = int(input())
a = [0]*n
b = [0]*n
c = [0]*n
for i in range(n):
    a[i], b[i], c[i] = map(int, input().split())

dpa = a[0]+[0]*(n-1)
dpb = b[0]+[0]*(n-1)
dpc = c[0]+[0]*(n-1)
for i in range(1,n):
    dpa[i] = max( dpb[i-1]+a[i], dpc[i-1]+a[i])
    dpb[i] = max( dpc[i-1]+b[i], dpa[i-1]+b[i])
    dpa[i] = max( dpa[i-1]+c[i], dpb[i-1]+c[i])

print(max(dpa[-1], dpb[-1], dpc[-1]))

### FIXED CODE ###

n = int(input())
h = tuple(map(int, input().split()))

dp = [0]*n
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for i in range(2,n):
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])
#include <iostream>
using namespace std;
#define M 1000000007
int main()
{
	long long a[200000], i,n, j, s=0, su=0;
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> a[i];
		s=(s+a[i])%M;
	}
	for (i = 0; i < n; i++)
	{
		s -= a[i];
		s+=M;
		s%=M;
		su += (a[i] * s)%M;
		su %= M;
	}
	cout << su;
}

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
s=sum(l)
su=0
for i in range(n):
	s=s-l[i]
	s=s%1000000007
	su=su+(l[i]*s)
	su=su%1000000007
print(su)
def main():
    n,k = map(int,input().split())
    s = list(input())
    s[k - 1] = chr(ord(s[k]) + 32)
    t = ''
    for i in s:
        t = t + i
    print(t)
main()

### FIXED CODE ###

def main():
    n,k = map(int,input().split())
    s = list(input())
    s[k - 1] = chr(ord(s[k - 1]) + 32)
    t = ''
    for i in s:
        t = t + i
    print(t)
main()
import sympy

n = int(input())

tmp = n - 1
ret = len(sympy.divisors(tmp)) - 1

tmplen = sympy.divisors(n)

for item in tmplen:
    if item == 1:
        continue
    val = n
    while True:
        if val % item == 0:
            val = val // item
        else:
            if val % item == 1:
                ret += 1
            break

print(ret)


### FIXED CODE ###

def make_divisors(n):
    lower_divisors, upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n = int(input())

tmp = n - 1
ret = len(make_divisors(tmp)) - 1

tmplen = make_divisors(n)

for item in tmplen:
    if item == 1:
        continue
    val = n
    while True:
        if val % item == 0:
            val = val // item
        else:
            if val % item == 1:
                ret += 1
            break

print(ret)
from sys import exit, stderr, stdin
input = stdin.readline
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    L, R = [int(n) for n in input().split()]
    if (L//2019)<(R//2019):
        print(0)
    else:
        l = L%2019
        r = R%2019
        res = 2019**2
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                res = min(res,(i*j)%MOD)
        print(res)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import exit, stderr, stdin
input = stdin.readline
def debug(var, name="hoge"):
    print(name +":" + str(type(var)) + " = " + repr(var), file=stderr)
    return


def main():
    L, R = [int(n) for n in input().split()]
    if (L//2019)<(R//2019):
        print(0)
    else:
        l = L%2019
        r = R%2019
        res = 2019**2
        for i in range(l,r+1):
            for j in range(i+1,r+1):
                res = min(res,(i*j)%2019)
        print(res)


if __name__ == "__main__":
    main()
N = int(input())
if N % 2 = 0:
  print(N)
else print(N*2)

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  print(N)
else:
  print(N*2)
k = int(input())
if k%2 = 0:
	print(-1)
elif k%5 = 0:
	print(-1)
else:
	s = 7
	while s%k != 0:
		s = 10*s+7
	print(len(s))

### FIXED CODE ###

import sys

k = int(input())

a = 0

for i in range(1, k+1):
	a = (a*10+7)%k
	if a == 0:
		print(i)
		sys.exit()
print(-1)
def main():
    N = int(input())
    S = [[] * N for i in range(N)]
    ans = 0

    for i in range(N):
        A = int(input())
        for j in range(A):
            x, y = map(int, input().split())
            S[i].append([x-1, y])

    P = [0]*N

    for i in range(2**N):
        for j in range(N):
            if P[j] == 0:
                P[j] = 1
                break
            else:
                P[j] = 0

        if sum(P) <= ans:
            continue
        flag = 0
        for p in range(len(P)):
            if P[p] == 1:
                for s in S[p]:
                    if s[1]!= P[s[0]]:
                        flag = 1
        if flag == 1:
            continue
        else:
            ans = sum(P)

    print(ans)


 
if name == 'main':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    S = [[] * N for i in range(N)]
    ans = 0

    for i in range(N):
        A = int(input())
        for j in range(A):
            x, y = map(int, input().split())
            S[i].append([x-1, y])

    P = [0]*N
    
    for i in range(2**N):
        for j in range(N):
            if P[j] == 0:
                P[j] = 1
                break
            else:
                P[j] = 0
        
        if sum(P) <= ans:
            continue
        flag = 0
        for p in range(len(P)):
            if P[p] == 1:
                for s in S[p]:
                    if s[1]!= P[s[0]]:
                        flag = 1
        if flag == 1:
            continue
        else:
            ans = sum(P)
        
    print(ans)


 
if __name__ == '__main__':
    main()
from bisect import bisect_left
n, m = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(n)]
t = [[] for _ in range(n)]
for p, y in data:
  t[p - 1].append(y)
for i in range(n):
  t[i].sort()
for p, y in data:
  nth = bisect_left(t[p - 1], y) + 1
  print("%06d%06d" % (p, nth))


### FIXED CODE ###

from bisect import bisect_left
n, m = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(m)]
t = [[] for _ in range(n)]
for p, y in data:
  t[p - 1].append(y)
for i in range(n):
  t[i].sort()
for p, y in data:
  nth = bisect_left(t[p - 1], y) + 1
  print("%06d%06d" % (p, nth))
def check(N):
    if type(N) == int and N >= 0 and N <= 9:
        print(N**3)
check(N)

### FIXED CODE ###

N = int(input())
if N >= 1 and N <= 9:
  print(N**3)
from math import gcd

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

snack = (A * B) // gcd(A, B)

print(snack)

### FIXED CODE ###

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x % y == 0:
        return y
    else:
        while x % y != 0:
            z = x % y
            x = y
            y = z
        return z


def lcm(m, n):
    return (m * n) // gcd(m, n)


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

# lcm
snack = lcm(A, B) 

print(snack)
import itertools

N = int(input())
S = [0] * N
ans = 0
for i in range(N):
    s = input()
    if s[0] in ['M', 'A', 'R', 'C', 'H']:
        S[i] = s
S = list(set(S))
S.remove(0)
march = [0] * 5
for i in S:
    if i[0] == 'M':
        march[0] += 1
    elif i[0] == 'A':
        march[1] += 1
    elif i[0] == 'R':
        march[2] += 1
    elif i[0] == 'C':
        march[3] += 1
    else:
        march[4] += 1

for i, j, k in list(itertools.combinations([0, 1, 2, 3, 4], 3)):
    ans += march[i] * march[j] * march[k]
print(ans)

### FIXED CODE ###

import itertools
N = int(input())
M, A, R, C, H = 0, 0, 0, 0, 0
final_ans = 0
for i in range(N):
    a = input()
    if a[0] =='M':
        M += 1
    elif a[0] =='A':
        A += 1
    elif a[0] =='R':
        R += 1
    elif a[0] =='C':
        C += 1
    elif a[0] =='H':
        H += 1

MARCH = [M, A, R, C, H]
ans = list(itertools.combinations(MARCH,3))

final_ans = 0
for i in ans:
    final_ans += i[0]*i[1]*i[2]
print(final_ans)
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
def nap(N,goods):
    dp=[-1*float('inf')]*(N+1)
    dp[0]=0
    for i in range(N):
        for w,v in goods:
            if i+w<=N:
                dp[i+w]=max(dp[i+w],dp[i]+v)
    return max([dp[i]+N-i for i in range(N+1)])
goods1=[(a,b) for a,b in zip(A,B) if a<b]
goods2=[(b,a) for a,b in zip(A,B) if a>b]
N=nap(N,[(a,b) for a,b in zip(A,B)])
if len(goods2)==0:
    print(N)
elif len(goods2)==1:
    print(N%goods2[0]+(N//goods2[0])*goods2[1])
elif len(goods2)==3:
    print(nap(N,goods2))
else:
    a,b,c,d=goods2[0][0],goods[0][1],goods[1][0],goods[1][1]
    if b-a<d-c:
        a,b=c,d
    elif b-a==d-c and a>c:
        a,b=c,d
    bord=(N//a)*b+((N%a)//c)*d
    x=N//a
    ans=bord
    for i in range(1,1+x):
        now=(x-i)*b+((N-(x-i)*a)//c)*d
        if now+d<bord:
            break
        else:
            ans=max(ans,now)
    print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
def nap(N,goods):
    dp=[-1*float('inf')]*(N+1)
    dp[0]=0
    for i in range(N):
        for w,v in goods:
            if i+w<=N:
                dp[i+w]=max(dp[i+w],dp[i]+v)
    return max([dp[i]+N-i for i in range(N+1)])
goods1=[(a,b) for a,b in zip(A,B) if a<b]
goods2=[(b,a) for a,b in zip(A,B) if a>b]
if len(goods1)>0:
    N=nap(N,[(a,b) for a,b in zip(A,B)])
if len(goods2)==0:
    print(N)
elif len(goods2)==1:
    print(N%goods2[0][0]+(N//goods2[0][0])*goods2[0][1])
elif len(goods2)==3:
    print(nap(N,goods2))
else:
    a,b,c,d=goods2[0][0],goods2[0][1],goods2[1][0],goods2[1][1]
    if (b-a)/a<(d-c)/c:
        a,b,c,d=c,d,a,b
    elif (b-a)/a==(d-c)/c and a>c:
        a,b,c,d=c,d,a,b
    bord=(N//a)*b+((N%a)//c)*d+(N%a)%c
    x=N//a
    ans=bord
    for i in range(1,1+x):
        now=(x-i)*b+((N-(x-i)*a)//c)*d+(N-(x-i)*a)%c
        if now+d<ans:
            break
        else:
            ans=max(ans,now)
    print(ans)
a, b = map(int, input().split())
if a<=b*2:
    print(0)
else:
    print(a-b*2)a, b = map(int, input().split())
if a<=b*2:
    print(0)
else:
    print(a-b*2)

### FIXED CODE ###

a, b = map(int, input().split())
if a<=b*2:
    print(0)
else:
    print(a-b*2)
n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

for i in range(n):
    for j in range(3):
        if s[i + j] != pattern[j]:
            match = False
            break
    if match:                   # すべての文字が一致していればカウント
        cnt += 1

print(cnt)

### FIXED CODE ###

n = int(input())
s = input()      
pattern = list('ABC')          
cnt = 0

for i in range(n-len(pattern)+1):
    if s[i] == pattern[0]:
        if s[i+1] == pattern[1]:
            if s[i+2] == pattern[2]:
                cnt += 1

print(cnt)
def main():
  N = map(int,input.split())
  S = input()
  black = S.count('#')
  white = S.count('.')

  if black == N or white == N:
    print(0)
    return 
 	
  B = [0]*(N+1)
  W = [0]*(N+1)
  for i in range(N):
    if S[i] == '#':
      B[i+1] = 1
    elif W[i] == '.':
      W[i+1] = 1
  
  for i in range(1,N+1):
    B[i]+=B[i-1]
    W[i]+=W[i-1]
  ans = float('inf')
  for i in range(1,N+1):
    ans = min(ans, B[i]+white-W[i])
  
main()

### FIXED CODE ###

N=int(input())
S=list(map(int,input().replace('#','1').replace('.','0')))
 
cum=[0]
for i in range(N):
  cum.append(cum[-1]+S[i])
  
ans=10**20
for i in range(N+1):
  b = cum[i]
  w = N-i-(cum[-1]-cum[i])
  ans = min(ans,b+w)
  
print(ans)
n,m,k = map(int,input().split())

if k >= n:
    n1 = 0
    if k >= n+m:
        m1 = 0
    else:
        m1 = m+n-k
print("{} {}".format(n1,m1))


### FIXED CODE ###

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

if k >= n+m:
    print("0 0")
elif n+m > k >=n:
    m -= (k-n)
    print("0 {}".format(m))
else:
    print("{} {}".format(n-k,m))
def gcd(_a,_b):
    b,a=sorted((_a, _b))
    while True:
        m=a%b
        if m==0:
            return b
        a=b;b=m

a,b,k=(int(x) for x in input().split())
g=gcd(a,b)
cd=[]
i=g
while True:
    if g%i==0:
        cd.append(i)
        i=i//2
        if i==0:
            break
    else:
        i-=1
print(cd[k-1])

### FIXED CODE ###

def gcd(t):
    b,a=sorted(t)
    while True:
        m=a%b
        if m==0:
            return b
        a=b;b=m
a,b,k=(int(x) for x in input().split())
g=gcd((a,b))
cd=[]
for i in range(g+1)[::-1]:
    if i==0:
        break
    if g%i==0:
        cd.append(i)
print(cd[k-1])
N = input()

l = len(N)

if N[i::] == "9"*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))

### FIXED CODE ###

N = input()
l = len(N)

if N[1::] == '9'*(l-1):
    print(int(N[0])+9*(l-1))
else:
    print(int(N[0])-1+9*(l-1))
N = int(input())
i = int(input())
print(N+1-i)

### FIXED CODE ###

n,i = map(int,input().split(" "))
print(n+1-i)
n=int(input())
a=[]
k=2
for i in range(55):
    while k < 55555 :
        k += 1
        b=k
        for j in a:
            if k%j==0:
                b=0
    
        if b==k:
            a.append(k)
            break
 
ans=[]
for j in range(len(a)):
    if len(ans) < n:
        if a[j] % 5 == 1:
            ans.append(a[j])
            
            
print(*ans)

### FIXED CODE ###

def main():
    n=int(input())
    a=[]
    s=[]
    t=0
    for k in range(3,55556):
        b=k
        for j in s:
            if k%j==0:
                b=0
        if b==k:
            s.append(k)
            if k % 5 == 1:
                if t < n:
                    a.append(k)
                    t += 1
                else:
                    break
     
    print(*a)
    
    
    
main()
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c, d = LI()
    print(max(a * b, c * d))
    return

#B
def B():
    _ = II()
    s = S()
    d["I"] = 1
    d["D"] = -1
    ans = 0
    now = 0
    for i in s:
        now += d[i]
        ans = max(ans, now)
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, c, d = LI()
    print(max(a * b, c * d))
    return

#B
def B():
    _ = II()
    s = S()
    d = {}
    d["I"] = 1
    d["D"] = -1
    ans = 0
    now = 0
    for i in s:
        now += d[i]
        ans = max(ans, now)
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()
a,b = map(int,input().split())
if a<=8 and b<=8:
  print("Yay!")
  else:
    print(":(")


### FIXED CODE ###

a,b = map(int,input().split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")