CodeEff/ECCO huggingface dataset:
# Original solution
# AtCoder Regular Contest 080
# C - 4-adjacent

N=int(eval(input()))
alist=list(map(int,input().split()))

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if N%2==1:  # N>3 ,Nが奇数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

else:   # N>3 ,Nが偶数の時
    if other%2==1:  #かつ、要素が偶数である数が奇数の時  
        if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()
    else:
        if (N-((other//2)*2))//2 <= mod40:
            print("Yes")
            exit()
        else:
            print("No")
            exit()

# Optimized solution
# AtCoder Regular Contest 080
# C - 4-adjacent

N=int(eval(input()))
alist=list(map(int,input().split()))

oddcount=0
mod40=0
other=0

for a in alist:
    if a%2==1:
        oddcount+=1
    elif a%4==0:
        mod40+=1
    else:
        other+=1

if N==1:
    if mod40==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
if N==2 or N==3:
    if mod40>0 or other==N:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# ↑ここまではあってそう。

if N%2==1:  # N>3 ,Nが奇数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()

else:   # N>3 ,Nが偶数の時
    if (N-((other//2)*2))//2 <= mod40:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
# Original solution
from collections import defaultdict


N = int(input())
counter = defaultdict(int)
for a in map(int, input().split()):
    if a % 4 == 0:
        counter[2] += 1
    elif a % 2 == 0:
        counter[1] += 1
    else:
        counter[0] += 1
if counter[1] == 0:
    print('Yes') if counter[0] <= counter[2] + 1 else print('No')
else:
    print('Yes') if counter[0] <= counter[2] else print('No')


# Optimized solution
from collections import Counter


N = int(input())
c = Counter(map(lambda x: int(x) % 4, input().split()))
print('Yes') if sum([c[1], c[2] > 0, c[3]]) <= c[0] + 1 else print('No')
# Original solution
n=int(eval(input()))
l=list(map(int,input().split()))

c_4=0
even=0
odd=0

for i in l:
  if i%4==0:
    c_4+=1
  elif i%2==0:
    even+=1
  else:
    odd+=1
  
if even==0 and odd-1 <= c_4:
  ans="Yes"
else:
  ans="No"
  
if even>0 and odd <= c_4:
  ans="Yes"
else:
  "No"

print(ans)

# Optimized solution
n=int(eval(input()))
l=list(map(int,input().split()))

c_4=0
even=0
odd=0

for i in l:
  if i%4==0:
    c_4+=1
  elif i%2==0:
    even+=1
  else:
    odd+=1
  
if even==0 and odd-1 <= c_4:
  ans="Yes"
else:
  ans="No"
  
if even>0 and odd <= c_4:
  ans="Yes"
elif even>0:
  ans="No"

print(ans)
# Original solution
def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
counter = 0
for i in A[::-1]:
	if (i not in pat):
		pat.append(i)
		pos[i] = counter
		counter += 1
		if(counter == M):
			break
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)
for i in A[::-1]:
	temp = pos[i]
	if (freq[temp] > 0):
		freq[temp] -= 1
		freq[temp+1] += 1
for i in range(M):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")


# Optimized solution
def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
found = set()
counter = 0
for i in A[::-1]:
	if (i not in found):
		pat.append(i)
		found.add(i)
		pos[i] = counter
		counter += 1
		if(counter == M):
			break
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)	
for i in A[::-1]:
	temp = pos[i]
	if (freq[temp] > 0):
		freq[temp] -= 1
		freq[temp+1] += 1
start = M
for i in range(M):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")
# Original solution
def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
found = set()
counter = 0
for i in A[::-1]:
	if (i not in found):
		pat.append(i)
		found.add(i)
		pos[i] = counter
		counter += 1
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)	
for i in A[::-1]:
	temp = pos[i]
	if (freq[temp] > 0):
		freq[temp] -= 1
		freq[temp+1] += 1
for i in range(M+1):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")


# Optimized solution
def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
found = set()
counter = 0
for i in A[::-1]:
	if (i not in found):
		pat.append(i)
		found.add(i)
		pos[i] = counter
		freq[counter] -= 1
		counter += 1
		freq[counter] += 1
	elif (freq[pos[i]] > 0):
		freq[pos[i]] -= 1
		freq[pos[i]+1] += 1
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)
for i in range(M+1):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")
# Original solution
import sys
import math
def v():
    pt=[5,0,1,2]
    N=100000
    s=list(['0' if x=='g' else '1' for x in list(sys.stdin.readline().strip())])
    n,x=len(s),int(''.join(s),2)
    s=list(format(x<<(N-n),'0100000b'))
    p=pt[n%4]
    for _ in range(n//4):p=(p<<4)+5
    ss=list(format(p<<(N-n),'010000b'))
    res=0
    for _,a,b in zip(list(range(n)),s,ss):
        d=int(b)-int(a)
        res = res if d==0 else res+d
    print(res)
if __name__=='__main__':v()


# Optimized solution
import sys
def v():
    pt=[5,0,1,2]
    s=list(['0' if x=='g' else '1' for x in list(sys.stdin.readline().strip())])
    n=len(s)
    p=pt[n%4]
    for _ in range(n//4):p=(p<<4)+5
    ss=list(format(p,'b').zfill(n))
    res=0
    for a,b in zip(s,ss):
        d=int(b)-int(a)
        res = res if d==0 else res+d
    print(res)
if __name__=='__main__':v()
# Original solution
#len(s)//2-s.count("p")
iG = 0
iR = 0
for g in [int(_) for _ in list(input().rstrip().replace("g","1").replace("p","0"))]:
    if g :
        if 0 < iG:
            iR += 1
            iG -= 1
        else:
            iG += 1
    else:
        if 0 < iG:
            iG -= 1
        else:
            iR -= 1
            iG += 1
print(iR)


# Optimized solution
#len(s)//2-s.count("p")
iG = 0
iR = 0
for s in input().rstrip():
    if s == "g" :
        if 0 < iG:
            iR += 1
            iG -= 1
        else:
            iG += 1
    else:
        if 0 < iG:
            iG -= 1
        else:
            iR -= 1
            iG += 1
print(iR)
# Original solution
def d_AtCoDeer_and_RockPaper(S):
    # 解説どおり
    n = len(S)  # ターン数
    p = 0  # 相手がパーを出した回数
    for c in S:
        if c == 'p':
            p += 1
    return n // 2 - p

S = input().strip()
print((d_AtCoDeer_and_RockPaper(S)))

# Optimized solution
def d_atcodeer_and_rock_paper(S):
    return len(S) // 2 - S.count('p')

S = input().strip()
print((d_atcodeer_and_rock_paper(S)))
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    g, p = 0, 0
    ans = 0
    for c in S:
        if g > p:
            p += 1
            if c == 'g':
                ans += 1
        else:
            g += 1
            if c == 'p':
                ans -= 1

    print(ans)
    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()

    ans = len(S) // 2 - S.count('p')

    print(ans)
    return


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))


T = [None] * N

c = 0

from functools import reduce

def check():
    def f(a, b):
        return a * b

    global c
    r = reduce(f, T)
    # print(T, r)
    if r % 2 == 0:
        c += 1


def dfs(pos):
    if pos == N:
        check()
        return

    T[pos] = A[pos] - 1
    dfs(pos+1)

    T[pos] = A[pos]
    dfs(pos+1)

    T[pos] = A[pos] + 1
    dfs(pos+1)

dfs(0)

print(c)

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))

total = 3 ** N
ng = 1
for ai in A:
    if ai % 2 == 0:
        ng *= 2

print((total-ng))
# Original solution
from itertools import product

n = int(eval(input()))
A = list(map(int, input().split()))

count = 0
for C in product((-1, 0, 1), repeat=n):
  total = 1
  for a, c in zip(A, C):
    total *= (a + c)
  if total % 2 == 0:
    count += 1
print(count)

# Optimized solution
n = int(eval(input()))
A = list(map(int, input().split()))

count = 1
for a in A:
  count *= 2 if a % 2 == 0 else 1
print((3 ** n - count))
# Original solution
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(eval(input()))
a = readints()


def func(l):
    if len(l) == n:
        for i in range(len(l)):
            if l[i] % 2 == 0:
                return 1

        return 0
    return func(l+[(a[len(l)])])+func(l+[(a[len(l)]-1)])+func(l+[(a[len(l)]+1)])


print((func([])))


# Optimized solution
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(eval(input()))
a = readints()
sum = 1
for i in range(len(a)):
    if a[i] % 2 == 0:
        sum *= 2
    else:
        sum *= 1
print((3**len(a)-sum))
# Original solution
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    if N == 1:
        return print(1 if A[0] % 2 == 0 else 2)
    ans = 0
    d = (-1, 0, 1)
    from itertools import product
    for i in product(range(3), repeat=N):
        cur = 1
        for j in range(N):
            cur *= (A[j] + d[i[j]])
        if cur % 2 == 0:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


# Optimized solution
def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    ans = 3**N
    cnt = len([a for a in A if a % 2 == 0])
    ans -= 2**cnt
    print(ans)


if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = [int(x) for x in input().split()]
ret = 0
for state in range(1 << N):
    flag = False
    ans = 1
    for i in range(N):
        if (state >> i & 1):
            if A[i] % 2 == 1:
                flag = True
            ans *= 2
        else:
            if A[i] % 2 == 0:
                flag = True
    if flag:
        ret += ans
print(ret)


# Optimized solution
def main() -> None:
    N = int(eval(input()))
    ans = 3 ** N
    odd = 1
    for a in map(int, input().split()):
        if a % 2 == 0:
            odd *= 2
    print((ans - odd))


if __name__ == '__main__':
    main()
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))

amax = []
amin = []

for i in range(n):
    amax.append(a[i] + 1)
    amin.append(a[i] - 1)

m = 3 ** n

for z in range(3 ** n):
    asearch = []
    amulti = 1
    x = z
    for i in range(n):
        asearch.append(x % 3)
        x = x // 3
    for i in range(n):
        if asearch[i] == 0:
            amulti *= a[i]
        elif asearch[i] == 1:
            amulti *= amax[i]
        else:
            amulti *= amin[i]
    if amulti % 2 != 0:
        m -= 1

print(m)

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
ans = 3 ** n
o = 1
for i in range(n):
    if a[i] % 2 == 0:
        o *= 2
    else:
        o *= 1
print((ans - o))
# Original solution
print((3**int(eval(input()))-2**sum(int(s)%2==0for s in input().split())))

# Optimized solution
print((3**int(eval(input()))-2**sum(~int(s)%2for s in input().split())))
# Original solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32


def solve(N: int, A: "List[int]"):
    ans = 1
    t = 1
    for i in range(N):
        # if A[i] == 1 or A[i] == 100:
        #     t *= 2
        #     continue

        t *= 3
        if A[i]%2 == 0:
            ans *= 2
        
    print((t-ans))

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000)
INF = 1<<32


def solve(N: int, A: "List[int]"):
    ans = 1
    t = 1
    for i in range(N):
        t *= 3
        if A[i]%2 == 0:
            ans *= 2
        
    print((t-ans))

    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))

odd_count = 1

for a in A:
  if a%2 != 0:
    odd_count *= 1
  else:
    odd_count *= 2

print((3**N - odd_count))

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))

odd_count = 1

for a in A:
  if a%2 == 0:
    odd_count *= 2

print((3**N - odd_count))
# Original solution
from functools import reduce
from itertools import product

N = int(eval(input()))
*A, = list(map(int, input().split()))
ans = 0
for t in product([-1, 0, 1], repeat=N):
    prod = reduce(lambda x, y: x*y, [a + t[i] for i, a in enumerate(A)])
    if prod % 2 == 0: ans += 1
print(ans)

# Optimized solution
N = int(eval(input()))
*A, = list(map(int, input().split()))
evens = 0
for a in A:
    if a % 2 == 0: evens += 1
ans = 3**N - 2**evens
print(ans)
# Original solution
n = int(eval(input()))
a = sum(list([1-int(x)%2 for x in input().split()]))
print((3**n-2**a))


# Optimized solution
print((3**int(eval(input()))-2**sum(list([1-int(x)%2 for x in input().split()]))))
# Original solution
N = int(eval(input()))
As = list(map(int,input().split()))


def dfs(A_s, index,Bss):
    if index == N:
        tmp = 1
        for b in Bss:
            tmp *= b
        return 1 if tmp % 2 == 0 else 0
    b_mi = Bss.copy()
    b_mi.append(A_s[index] - 1)

    b = Bss.copy()
    b.append(A_s[index])

    b_pl = Bss.copy()
    b_pl.append(A_s[index] + 1)
    return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)


print((dfs(As,0,[])))


# Optimized solution
N = int(eval(input()))
As = list(map(int,input().split()))

tmp = 1
for i in range(N):
    if As[i] % 2 == 0:
       tmp *= 2

print((3 ** N - tmp))
# Original solution
n = int(eval(input()))
print(('ABC' if n<1000 else 'ABD'))

# Optimized solution
print(('ABD' if int(eval(input()))>=1000 else 'ABC'))
# Original solution
n = int(eval(input()))
if n < 1000:
    print("ABC")
else:
    print("ABD")

# Optimized solution
n = int(eval(input()))
if n > 999:
    print("ABD")
else:
    print("ABC")
# Original solution
n = int(eval(input()))
if n <= 999:
    print('ABC')
else:
    print('ABD')


# Optimized solution
n = int(eval(input()))
if n >= 1000:
    print('ABD')
else:
    print('ABC')
# Original solution
print(('AB'+('C' if int(eval(input())) < 1000 else 'D')))

# Optimized solution
N = int(eval(input()))

if N < 1000:
  ans = "ABC"
  
  N += 1000
  N = str(N)
  N = N[1:]
  ans += N
  
else:
  ans = "ABD"
  
  N -= 999
  N += 1000
  N = str(N)
  N = N[1:]
  ans += N
  
print((ans[:3]))
# Original solution
print((('ABC','ABD')[len(input()[3:])]))

# Optimized solution
print((('ABD','ABC')[not input()[3:]]))
# Original solution
N=eval(input())
N=int(N)
if N<1000:
    print('ABC')
elif N>=1000:
    print('ABD')

# Optimized solution
N=eval(input())
N=int(N)
if N<1000:
    print('ABC')
else:
    print('ABD')
# Original solution
#S=input()
N=int(eval(input()))
#A,B=map(int,input().split())
if N<1000:
    print("ABC")
else:
    print("ABD")

# Optimized solution
N=int(eval(input()))
if N>999:
    print("ABD")
else:
    print("ABC")
# Original solution
print(("ABC" if int(eval(input()))<1000 else "ABD"))

# Optimized solution
print((['ABC','ABD'][int(eval(input()))>999]))
# Original solution
print(('ABC' if int(eval(input())) < 1000 else 'ABD'))

# Optimized solution
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
answer = 'ABC' if N < 1000 else 'ABD'
print(answer)
# Original solution
def main():
    num = int(eval(input()))
    if num<1000:
        ans = 'ABC'
    elif num < 1999:
        ans = 'ABD'
    else:
        print("error")
        
    print(ans)
    
    
if __name__ == "__main__":
    main()

# Optimized solution
N = int(eval(input()))
if N < 1000:
    print("ABC")
else:
    print("ABD")
# Original solution
a = int(eval(input()))
if a > 999:
  print("ABD")
else:
  print("ABC")

# Optimized solution
a=int(eval(input()))
print(("ABC" if a<1000 else "ABD"))
# Original solution
print("ABC") if int(input())<=999 else print("ABD")


# Optimized solution
if int(eval(input()))<1000:
  print("ABC")
else:
  print("ABD")
# Original solution
n=int(eval(input()))

if n<=999:
    print("ABC")
else:
    print("ABD")

# Optimized solution
if int(eval(input()))<=999:
    print("ABC")
else:
    print("ABD")
# Original solution
n=int(eval(input()))
if n<=999:
    print('ABC')
else:
    print('ABD')

# Optimized solution
n=int(eval(input()))
print(('ABC' if n<1000 else 'ABD'))
# Original solution
n = int(eval(input()))

if n <= 999:
    print("ABC")
else:
    print("ABD")


# Optimized solution
n = int(eval(input()))

if n < 1000:
    ans = "ABC"
else:
    ans = "ABD"
print(ans)
# Original solution
# -*- coding: utf-8 -*-
N = int(eval(input()))
if N >=  1000:
  print("ABD")
else:
  print("ABC")

# Optimized solution
N = int(eval(input()))

if N >= 1000:
    print("ABD")
else:
    print("ABC")
# Original solution
n = int(eval(input()))
if n < 1000:
    print('ABC')
else:
    print('ABD')

# Optimized solution
N = int(eval(input()))
print(('ABC' if N < 1000 else 'ABD'))
# Original solution
from sys import stdin
import fractions

n = int(stdin.readline().rstrip())

if n <1000:
    print("ABC")

else:
    print("ABD")

# Optimized solution
n = int(eval(input()))
if n < 1000:
    print("ABC")
else:
    print("ABD")
# Original solution
n=int(eval(input()))
if n<=999:
    print("ABC")
else:
    print("ABD")


# Optimized solution
n=int(eval(input()))
x=n-999 if n>999 else n
if n>999:
    print("ABD")
else:
    print("ABC")
# Original solution
a, b, x = list(map(int, input().split()))
if a%x == 0:
    print(((b//x+1) - (a//x)))
else:
    print(((b//x+1) - (a//x+1)))


# Optimized solution
a, b, x = list(map(int, input().split()))

def f(n):
    if n == -1:
        return 0
    else:
        return n//x + 1
print((f(b) - f(a-1)))
# Original solution
from decimal import *
a, b, x = list(map(int, input().split()))
ax = int(Decimal(a) / Decimal(x))
bx = int(Decimal(b) / Decimal(x))
am = a % x
bm = b % x
if ax == bx and am != 0 and bm != 0:
  print((0))
elif am == 0:
  print((bx - ax + 1))
else:
  print((bx - ax))

# Optimized solution
a, b, x = list(map(int, input().split()))
ans = b // x - a // x
if a % x == 0:
  ans += 1
print(ans)
# Original solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b,x=list(map(int, input().split()))
    if a!=0:
        amade=(a-1)//x
        bmade=b//x
        print((bmade-amade))
    else:
        print((b//x+1))
resolve()

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    a,b,x=list(map(int, input().split()))
    amade=(a-1)//x
    bmade=b//x
    print((bmade-amade))
resolve()
# Original solution
a, b, x = list(map(int, input().split()))

for i in range(x):
  fa = a+i
  if fa%x == 0:
    break

if b < fa:
  print((0))
else:
  print((1+(b-fa)//x))

# Optimized solution
a, b, x = list(map(int, input().split()))

i = 0
fa = x*i
while x*i < a:
  i += 1
  fa = x*i

if b < fa:
  print((0))
else:
  print((1+(b-fa)//x))
# Original solution
from decimal import *
#exp = Decimal(10**23)
#rint((Decimal(11)*exp)/Decimal(10))

## coding: UTF-8
s = input().split()
t = [int(p) for p in s]
#print(t)

a = t[0]
b = t[1]
x = t[2]

start = a
goal = b
while True:
    if(start % x == 0):
        break
    else:
        start += 1
#print(start)
while True:
    if(goal % x == 0):
        break
    else:
        goal -= 1
#start = Decimal(3)
#goal = Decimal(999999999999999999)

#print(Decimal(goal))
print((Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  )) 
#answer = ((goal - start) / x ) + 1
#print('{}'.format(int(answer)))

# Optimized solution
from decimal import *
#exp = Decimal(10**23)
#rint((Decimal(11)*exp)/Decimal(10))

## coding: UTF-8
s = input().split()
t = [int(p) for p in s]
#print(t)

a = t[0]
b = t[1]
x = t[2]

'''
start = a
goal = b
while True:
    if(start % x == 0):
        break
    else:
        start += 1
#print(start)
while True:
    if(goal % x == 0):
        break
    else:
        goal -= 1
#start = Decimal(3)
#goal = Decimal(999999999999999999)

#print(Decimal(goal))
print(Decimal(Decimal(Decimal(goal) - Decimal(start)) / Decimal(x)) + Decimal(1)  ) 
#answer = ((goal - start) / x ) + 1
#print('{}'.format(int(answer)))
'''

def count_even(t, x):
    return int( Decimal(t)/ Decimal(x) )

if( a == 0):
    answer = count_even(b, x) + 1
else:
    answer = count_even(b, x) - count_even(a-1, x)
print(answer)