On the planet Mars a year lasts exactly n days (there are no leap years on Mars). But Martians have the same weeks as earthlings — 5 work days and then 2 days off. Your task is to determine the minimum possible and the maximum possible number of days off per year on Mars.


-----Input-----

The first line of the input contains a positive integer n (1 ≤ n ≤ 1 000 000) — the number of days in a year on Mars.


-----Output-----

Print two integers — the minimum possible and the maximum possible number of days off per year on Mars.


-----Examples-----
Input
14

Output
4 4

Input
2

Output
0 2



-----Note-----

In the first sample there are 14 days in a year on Mars, and therefore independently of the day a year starts with there will be exactly 4 days off .

In the second sample there are only 2 days in a year on Mars, and they can both be either work days or days off.

Difficulty: EASY
Tags: Greedy algorithms

Complete search

Mathematics

Constructive algorithms
Skill types: Complete search

Greedy algorithms

Starter code:

Solutions:
n = int(input())
print(2 * (n // 7) + n % 7 // 6, 2 * ((n + 5) // 7) + (n + 5) % 7 // 6)


n = int(input())
if n >= 8:
	ans1 = (n - 5) // 7 * 2 + min(2, (n - 5) % 7)
	ans2 = (n - 2) // 7 * 2 + 2 + max(0, (n - 2) % 7 - 5)
elif n <= 2:
	ans1 = 0
	ans2 = n
elif n <= 5:
	ans1 = 0
	ans2 = 2
elif n == 6:
	ans1 = 1
	ans2 = 2
elif n == 7:
	ans1 = 2
	ans2 = 2
print('%d %d' % (ans1, ans2))


n = int(input())
if n < 7:
	if n < 2:
		print(0, n)
	elif 2 <= n <= 5:
		print(0, 2)
	else:
		print(1, 2)
else:
	p = n // 7 * 2
	q = n % 7
	if q < 2:
		print(p, p + q)
	elif 2 <= q <= 5:
		print(p, p + 2)
	else:
		print(p + 1, p + 2)


from math import sqrt

def main():
	n = int(input())
	min_v = n
	max_v = 0
	for i in range(0, 7):
		c = 0
		for j in range(0, n):
			if (i + j) % 7 == 6 or (i + j) % 7 == 5:
				c += 1
		max_v = max(max_v, c)
		min_v = min(min_v, c)
	print(min_v, max_v)
main()


days = int(input())
small = float('inf')
big = 0
for d in [0, 5]:
	off = 0
	for i in range(d, days + d):
		is_weekend = i % 7 in [5, 6]
		if is_weekend:
			off += 1
	small = min(small, off)
	big = max(big, off)
print(small, big)


def p(x):
	return x == 6 or x == 7
n = int(input())
a = len(list(filter(p, [i % 7 + 1 for i in range(n)])))
b = len(list(filter(p, [(i + 5) % 7 + 1 for i in range(n)])))
print(a, b)


n = int(input())
mn = 2 * (n // 7)
if n % 7 == 0:
	mx = mn
elif n % 7 == 1:
	mx = mn + 1
elif n % 7 == 6:
	mn = mn + 1
	mx = mn + 1
else:
	mx = mn + 2
print(mn, ' ', mx)


n = int(input())
w = n // 7
r = n % 7
if r == 1 or r == 2:
	print(2 * w, 2 * w + r)
elif r == 0:
	print(2 * w, 2 * w)
elif r == 6:
	print(2 * w + 1, 2 * (w + 1))
else:
	print(2 * w, 2 * (w + 1))


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	(q, r) = divmod(n, 7)
	MIN = q * 2 + max(r - 5, 0)
	MAX = q * 2 + min(r, 2)
	print(MIN, MAX)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

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

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def fib_to_n(n):
	f = []
	(a, b) = (0, 1)
	while a <= n:
		f.append(a)
		(a, b) = (b, a + b)
	return f

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

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def is_even(x):
	return x % 2 == 0

def is_odd(x):
	return x % 2 == 1

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		debug(n, i)
		if n % i == 0:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P

def is_lucky(n):
	return set(list(str(n))).issubset({'4', '7'})
main()


from collections import defaultdict
N = int(input())
min_list = ['M', 'T', 'W', 'TH', 'F', 'S', 'SU']
max_list = ['S', 'SU', 'M', 'T', 'W', 'TH', 'F']
min_dict = defaultdict(int)
max_dict = defaultdict(int)
for i in range(N):
	min_dict[min_list[i % 7]] += 1
	max_dict[max_list[i % 7]] += 1
print('{0} {1}'.format(min_dict['S'] + min_dict['SU'], max_dict['S'] + max_dict['SU']))


n = int(input())
if n % 7 != 6:
	print(n // 7 * 2, end=' ')
if n % 7 == 6:
	print(n // 7 * 2 + 1, end=' ')
print((n + 5) // 7 + (n + 6) // 7)


N = int(input())
WD = 5
WE = 2
minHoli = 0
maxHoli = 0
elapsed = 0
flgTurn = True
while elapsed <= N:
	if flgTurn:
		maxHoli += min(WE, N - elapsed)
		elapsed += WE
	else:
		elapsed += WD
	flgTurn = not flgTurn
flgTurn = True
elapsed = 0
while elapsed <= N:
	if not flgTurn:
		minHoli += min(WE, N - elapsed)
		elapsed += WE
	else:
		elapsed += WD
	flgTurn = not flgTurn
print('%d %d' % (minHoli, maxHoli))


n = int(input())
ma = n // 7 * 2 + min(n % 7, 2)
mi = n // 7 * 2 + max(n % 7 - 5, 0)
print(mi, ma)


from sys import stdin

def getOff(n, i):
	t = 0
	while i <= 7 and n > 0:
		if i == 6 or i == 7:
			t += 1
		i += 1
		n -= 1
	t += n // 7 * 2
	n = n % 7
	if n == 6:
		t += 1
	return t

def main():
	n = int(stdin.readline())
	(maxOff, minOff) = (0, n)
	for i in range(1, 8):
		t = getOff(n, i)
		maxOff = max(maxOff, t)
		minOff = min(minOff, t)
	print(minOff, maxOff)
main()


h = int(input())
f = h // 7
r = h % 7
print(f * 2 + max(r - 5, 0), f * 2 + min(2, r))


import math
n = int(input())
print(int(n / 7) * 2 + max(n % 7 - 5, 0), (n + 6) // 7 + (n + 5) // 7)


n = int(input())
if n % 7 == 0:
	print(n // 7 * 2, n // 7 * 2)
else:
	k = n % 7
	min = n // 7 * 2 + (1 if k == 6 else 0)
	max = n // 7 * 2 + (1 if k == 1 else 2)
	print(min, max)


from math import ceil
n = int(input())
r = n // 7
p = 0
p += r
ma = 2 * r
mi = 2 * r
re = n % 7
if re == 1:
	ma += 1
elif re >= 2 and re <= 5:
	ma += 2
elif re == 6:
	ma += 2
	mi += 1
elif re == 7:
	ma += 2
	mi += 2
print(mi, ma)


n = int(input())
cnt = 0
while n >= 7:
	n -= 7
	cnt += 2
a = cnt + int(n == 6)
b = cnt + min(2, n)
print(a, b)


def a657():
	(a, b, c) = map(int, input().split())
	if c >= 0 and b < a or (c <= 0 and b > a):
		print('NO')
		return 0
	if a == b or (b - a) % c == 0:
		print('YES')
	else:
		print('NO')

def a670():
	a = int(input())
	n = int(a / 7) * 2
	if 1 < a % 7 < 6:
		print(n, n + 2)
	elif a % 7 == 6:
		print(n + 1, n + 2)
	elif a % 7 == 1:
		print(n, n + 1)
	else:
		print(n, n)
a670()


n = int(input())
if n % 7 == 0:
	print(n // 7 * 2, n // 7 * 2)
else:
	x = n // 7
	y = n % 7
	z = 0
	if y == 6:
		z = 1
	if y >= 2:
		y = 2
	print(x * 2 + z, x * 2 + y)


n = int(input())
r = 2 * (n // 7)
if n % 7 < 6:
	a1 = r
else:
	a1 = r + 1
if n % 7 < 3:
	a2 = r + n % 7
else:
	a2 = r + 2
print(a1, a2)


n = int(input())
(div, mod) = divmod(n, 7)
if mod == 0:
	minimum = maximum = div * 2
elif mod == 1:
	minimum = div * 2
	maximum = div * 2 + 1
elif 1 < mod < 6:
	minimum = div * 2
	maximum = div * 2 + 2
else:
	minimum = div * 2 + 1
	maximum = div * 2 + 2
print(minimum, maximum)


s = input()
s = int(s)
if s % 7 == 0:
	x = int(s / 7 * 2)
	print(x, end=' ')
	print(x)
elif s < 7:
	if s % 7 == 1:
		print(0, end=' ')
		print(1)
	if s % 7 > 1 and s % 7 < 6:
		print(0, end=' ')
		print(2)
	if s % 7 == 6:
		print(1, end=' ')
		print(2)
else:
	if s % 7 == 1:
		x = int(s / 7) * 2
		print(x, end=' ')
		print(x + 1)
	if s % 7 > 1 and s % 7 < 6:
		x = int(s / 7) * 2
		print(x, end=' ')
		print(x + 2)
	if s % 7 == 6:
		x = int(s / 7) * 2
		print(x + 1, end=' ')
		print(x + 2)


n = int(input())
min = n // 7 * 2
max = (n - 2) // 7 * 2 + 2
if n % 7 == 6:
	min += 1
if (n - 2) % 7 == 6:
	max += 1
print(f'{min} {max}')


n = int(input())
week = n // 7
leftover = n % 7
print(week * 2 + max(leftover - 5, 0), week * 2 + min(leftover, 2))


from math import ceil
a = int(input())
x = a % 7
y = a // 7
mx = mn = y * 2
if x == 6:
	mn += 1
if x <= 2:
	mx += x
else:
	mx += 2
print(mn, mx)


n = int(input())
m = n % 7
from math import ceil, floor
print(2 * floor(n / 7) + (1 if m == 6 else 0), 2 * floor(n / 7) + min(2, m))


num_of_days = int(input())
if num_of_days % 7 == 0:
	print(int(num_of_days / 7 * 2), end=' ')
	print(int(num_of_days / 7 * 2))
elif (num_of_days - 1) % 7 == 0:
	print(int((num_of_days - 1) / 7) * 2, end=' ')
	print(int((num_of_days - 1) / 7) * 2 + 1)
elif num_of_days % 7 >= 2 and num_of_days % 7 < 6:
	print(int(num_of_days / 7) * 2, end=' ')
	print(int(num_of_days / 7) * 2 + 2)
else:
	print(int(num_of_days / 7) * 2 + 1, end=' ')
	print(int(num_of_days / 7) * 2 + 2)


n = int(input())
(min, max) = (n // 7 * 2, n // 7 * 2)
if n % 7 == 6:
	min += 1
	max += 2
elif n % 7 == 1:
	max += n % 7
elif n % 7 != 0:
	max += 2
print(min, max)


n = int(input())
fullweeks = n // 7
leftover = n % 7
minoff = fullweeks * 2
maxoff = fullweeks * 2
if leftover == 1:
	maxoff += 1
if leftover >= 2 and leftover <= 5:
	maxoff += 2
if leftover == 6:
	maxoff += 2
	minoff += 1
print(str(minoff) + ' ' + str(maxoff))


d = int(input())
print(2 * (d // 7) + (1 if d % 7 == 6 else 0), 2 * (d // 7) + min([d % 7, 2]))


__author__ = 'Andrey'
n = int(input())
k = n // 7
c = n % 7
print(2 * k + max(0, c - 5), 2 * k + min(c, 2))


n = int(input())
k = n // 7 * 2
ost = n % 7
if ost == 0:
	print(k, k)
if ost == 1:
	print(k, k + 1)
if ost > 1 and ost < 6:
	print(k, k + 2)
if ost == 6:
	print(k + 1, k + 2)


x = int(input())
if x == 1:
	print(0, 1)
elif x == 6:
	print(1, 2)
elif x % 7 == 0:
	print(2 * (x // 7), 2 * (x // 7))
elif x % 7 == 1:
	print(2 * (x // 7), 2 * (x // 7) + 1)
elif x % 7 == 6:
	print(2 * (x // 7) + 1, 2 * (x // 7) + 2)
else:
	print(2 * (x // 7), 2 * (x // 7) + 2)


n = int(input().strip())
x = n // 7
ans = x * 2
extra = n % 7
mini = str(ans + max(0, extra - 5))
maxi = str(ans + min(2, extra))
print(' '.join([mini, maxi]))


n = int(input())
print(2 * (n // 7) + n % 7 // 6, 2 * (n // 7) + n % 7 // 6 + min(2, n % 7, 7 - n % 7))


N = int(input())
maxans = N // 7 * 2 + min(N % 7, 2)
minans = N // 7 * 2
if N % 7 == 6:
	minans += 1
print('{} {}'.format(minans, maxans))


x = int(input())
print(x // 7 * 2 + max(0, x % 7 - 5), x // 7 * 2 + min(2, x % 7))


a = int(input())
b = int(a / 7)
c = int(a % 7)
if c == 6:
	print(b * 2 + 1)
else:
	print(b * 2)
if c >= 2:
	print(b * 2 + 2)
elif c == 1:
	print(b * 2 + 1)
else:
	print(b * 2)


n = int(input())
maxi = 2 * (n // 7) + min(n % 7, 2)
mini = 2 * (n // 7)
if n % 7 == 6:
	mini += 1
print(mini, maxi)


n = int(input())
ans = 0
res = 0
mn = 0
z = 0
rezwan = 0
if n % 7 == 0:
	ans = n // 7
	print(ans * 2, ans * 2)
else:
	res = n // 7
	mn = res * 2
	z = n % 7
	if z == 1:
		rezwan = mn + 1
	elif z == 2 or z == 3 or z == 4 or (z == 5):
		rezwan = mn + 2
	elif z == 6:
		rezwan = mn + 2
		mn += 1
	print(mn, rezwan)


a = int(input())
b = a // 7 * 2 + min(a % 7, 2)
c = a // 7
d = a - c * 7
e = 0 if d <= 5 else 7 - d
print(e + c * 2, b)


n = eval(input())
week = int(n / 7)
if n % 7 == 0:
	print(2 * week, ' ', 2 * week)
elif n % 7 == 6:
	print(2 * week + 1, ' ', 2 * week + 2)
elif n % 7 == 1:
	print(2 * week + 0, ' ', 2 * week + 1)
else:
	print(2 * week, ' ', 2 * week + 2)


n = int(input())
l = [0, 0, 0, 0, 0, 0, 1]
L = [0, 1, 2, 2, 2, 2, 2]
q = n // 7
r = n % 7
mi = 2 * q + l[r]
ma = 2 * q + L[r]
print(mi, ma)


n = input()
n = int(n)
import math
if n % 7 == 6:
	min = 2 * int(math.floor(n / 7)) + 1
elif n % 7 == 0:
	min = 2 * int(math.floor(n / 7))
else:
	min = 2 * int(math.floor(n / 7))
if n % 7 == 1:
	max = int(math.floor(n / 7)) * 2 + 1
elif n % 7 == 0:
	max = int(math.floor(n / 7)) * 2
else:
	max = int(math.floor(n / 7)) * 2 + 2
print(min)
print(max)


n = int(input())
d = n // 7
r = n % 7
print(2 * d + max(r, 5) - 5, 2 * d + min(2, r))


def work_mars():
	days = int(input())
	if days == 1:
		print(0, 1)
	elif days == 0:
		print(0, 0)
	elif days < 6:
		print(0, 2)
	elif days == 6:
		print(1, 2)
	elif days < 8:
		print(2, 2)
	else:
		takeoff = 0
		while True:
			if days % 7 != 0:
				days -= 1
				takeoff += 1
			else:
				break
		weeks = int(days / 7)
		if takeoff == 6:
			minimum = int(weeks * 2) + 1
		else:
			minimum = int(weeks * 2)
		if takeoff == 0:
			maximum = minimum
		elif takeoff == 1:
			maximum = minimum + 1
		elif takeoff != 6:
			maximum = minimum + 2
		else:
			maximum = minimum + 1
		print(minimum, maximum)
work_mars()


n = int(input())
a = 2 * (n // 7) + (n % 7 == 6)
b = 2 * (n // 7) + (n % 7 > 0) + (n % 7 > 1)
print(a, b)


n = int(input())
A = [0, 1, 2, 2, 2, 2, 2]
B = [0, 0, 0, 0, 0, 0, 1]
print(n // 7 * 2 + B[n % 7], n // 7 * 2 + A[n % 7])


n = int(input())
b = n / 7
d = n // 7
b = b - d
b = round(b, 2)
if b == 0.86:
	b = 2 * d + 1
else:
	b = 2 * d
c = n / 7
c = c - d
c = round(c, 2)
if c > 0 and c == 0.14:
	c = 2 * (n // 7) + 1
elif c > 0 and c > 0.14:
	c = 2 * (n // 7) + 2
else:
	c = int(2 * d)
print(b, c)


n = int(input())
weeks = n // 7
left = n - weeks * 7
mini = weeks * 2
maxi = weeks * 2
if left > 5:
	mini += 1
if left < 2:
	maxi += left
else:
	maxi += 2
print(mini, maxi)


n = int(input())
a = 0
if n % 7 == 6:
	a = 1
b = 0
if n % 7 == 1:
	b = 1
elif n % 7 >= 2:
	b = 2
print(2 * (n // 7) + a, 2 * (n // 7) + b)


import sys
n = int(input())
min = n // 7 * 2
k = n % 7
if k > 4:
	min += k - 5
max = n % 7
if max > 2:
	max = 2
print(min, n // 7 * 2 + max)


a = int(input())
if a == 1:
	print(0, 1)
elif 2 <= a < 6:
	print(0, 2)
elif a == 6:
	print(1, 2)
elif a == 7:
	print(2, 2)
elif a % 7 == 0:
	print(a // 7 * 2, a // 7 * 2)
elif a % 7 == 1:
	print(a // 7 * 2, a // 7 * 2 + 1)
elif a % 7 == 6:
	print(a // 7 * 2 + 1, a // 7 * 2 + 2)
else:
	print(a // 7 * 2, a // 7 * 2 + 2)


f = lambda : map(int, input().split())
a = int(input())
h = a // 7 * 2
print([h, h + 1][a % 7 == 6], end=' ')
print(h if a % 7 == 0 else [h + 1, h + 2][a % 7 != 1])


a = int(input())
ma = 0
s = 0
while True:
	if a == 6:
		s += 1
		ma -= 1
	if a < 7:
		if a >= 2:
			ma += 2
			break
		elif a == 1:
			ma += 1
			break
		else:
			break
	a -= 7
	s += 2
ma += s
print(s, ma)


n = input()
n = int(n)
if n % 7 == 0:
	print(int(2 * (n / 7)), int(2 * (n / 7)))
else:
	m = 2 * int(n / 7)
	m = int(m)
	if n % 7 == 1:
		print(m, m + 1)
	elif n % 7 == 6:
		print(m + 1, m + 2)
	else:
		print(m, m + 2)


n = int(input())
o = 2 * (n // 7)
l = n % 7
if l == 0:
	print(str(o) + ' ' + str(o))
elif l <= 5:
	if l >= 2:
		print(str(o) + ' ' + str(o + 2))
	else:
		print(str(o) + ' ' + str(o + 1))
else:
	print(str(o + 1) + ' ' + str(o + 2))


n = int(input())
if n >= 7 and n != 8:
	mn = 0
	k = n
	while k >= 7:
		(k, mn) = (k - 7, mn + 2)
		if k < 7 and k - 5 > 0:
			mn += k - 5
	mx = 2
	n -= 2
	while n >= 7:
		(n, mx) = (n - 7, mx + 2)
		if n < 7 and n - 5 > 0:
			mx += n - 5
	print(mn, mx)
else:
	if n == 8:
		print(2, 3)
	if n == 6:
		print(1, 2)
	if n == 5 or n == 4 or n == 3 or (n == 2):
		print(0, 2)
	if n == 1:
		print(0, 1)


sd = int(input())
rem = sd % 7
sd = (sd - rem) * 2 / 7
_Min = _Max = int(sd)
if rem == 6:
	_Min += 1
if rem >= 2:
	_Max += 2
if rem == 1:
	_Max += 1
print(_Min, ' ', _Max)


n = int(input())
Weeks = n // 7
Day = n % 7
Max = Min = Weeks * 2
if Day == 6:
	Min += 1
if Day >= 3:
	Day = 2
Max += Day
print(Min, Max)


def mars(n):
	if n == 1:
		return (0, 1)
	n1 = n // 7
	maximum = 2 * n1
	minimum = maximum
	if n % 7 > 1:
		maximum += 2
	elif n % 7 == 1:
		maximum += 1
	if n % 7 == 6:
		minimum += 1
	return (minimum, maximum)
print(*mars(int(input())))


n = int(input())
minDays = 0
maxDays = 0
if n >= 7:
	minDays = 2 * (n // 7)
	if n % 7 == 0:
		maxDays = minDays
	elif n % 7 == 1:
		maxDays = minDays + 1
	elif n % 7 >= 2 and n % 7 < 6:
		maxDays = minDays + 2
	elif n % 7 == 6:
		maxDays = minDays + 2
		minDays += 1
elif n == 1:
	minDays = 0
	maxDays = 1
else:
	if n == 6:
		minDays = 1
	else:
		minDays = 0
	maxDays = 2
print(minDays, maxDays)


a = int(input())
print(a // 7 + (a + 1) // 7, (a + 5) // 7 + (a + 6) // 7)


def solve():
	N = int(input())
	n7 = N // 7
	m7 = N % 7
	ma = n7 * 2 + min(m7, 2)
	mi = n7 * 2
	if m7 == 6:
		mi += 1
	print(mi, ma)

def __starting_point():
	solve()
__starting_point()


a = int(input())
n = a // 7 * 2
a %= 7
print(n + max(0, a - 5), n + min(2, a))


n = int(input())
z = 2 + 2 * ((n - 2) // 7) + max((n - 2) % 7 - 5, 0)
z2 = 2 * (n // 7) + max(n % 7 - 5, 0)
print(z2, z)


n = int(input())
temp = int(n / 7)
temp_rem = n % 7
if temp_rem > 1:
	if temp_rem - 5 > 0:
		print(temp * 2 + temp_rem - 5, temp * 2 + 2)
	else:
		print(temp * 2, temp * 2 + 2)
else:
	print(temp * 2, temp * 2 + temp_rem)


n = int(input())
mx = 0
m = 0
p = -5
mn = 0
for j in range(0, n):
	p += 1
	if p > 0:
		mn += 1
	if p == 2:
		p = -5
print(mn, end=' ')
for i in range(1, n + 1):
	m += 1
	if m > 0:
		mx += 1
	if m == 2:
		m = -5
print(mx)


def main():
	n = int(input())
	if n % 7 == 0:
		print(n // 7 * 2, n // 7 * 2)
	elif n % 7 != 0:
		if n % 7 <= 2:
			print(n // 7 * 2, n // 7 * 2 + n % 7)
		elif n % 7 == 6:
			print(n // 7 * 2 + 1, n // 7 * 2 + 2)
		else:
			print(n // 7 * 2, n // 7 * 2 + 2)
main()


n = int(input())
if n % 7 == 0:
	a = n // 7
	a *= 2
	print('{} {}'.format(a, a))
else:
	a = n // 7
	a *= 2
	mn = a
	if n % 7 == 6:
		mn += 1
	mx = a + min(2, n % 7)
	print('{} {}'.format(mn, mx))


minday = maxday = 0
for i in range(int(input())):
	k = i % 7
	if k == 0 or k == 1:
		maxday += 1
	if k == 5 or k == 6:
		minday += 1
print(minday, maxday)


n = int(input())
mini = int(n / 7) * 2
if n - 7 * int(n / 7) > 5:
	mini += n - 7 * int(n / 7) - 5
maxi = int(n / 7) * 2
if n - 7 * int(n / 7) > 2:
	maxi += 2
else:
	maxi += n - 7 * int(n / 7)
print(mini, maxi)


n = int(input())
if n % 7 == 6:
	print(2 * (n // 7) + 1, 2 * (n // 7) + (n % 7 if n % 7 < 3 else 2))
else:
	print(2 * (n // 7), 2 * (n // 7) + (n % 7 if n % 7 < 3 else 2))


n = int(input())
print(str(n // 7 * 2 + (1 if n % 7 == 6 else 0)) + ' ' + str((n + 5) // 7 * 2 + (1 if (n + 5) % 7 == 6 else 0)))


a = [0, 0, 0, 0, 0, 0, 1]
b = [0, 1, 2, 2, 2, 2, 2]
n = int(input())
x = 2 * (n // 7) + a[n % 7]
y = 2 * (n // 7) + b[n % 7]
print(x, y)


n = int(input())
c = n % 7
min1 = 2 * (n // 7) + max(0, n % 7 - 5)
max1 = 2 * (n // 7) + min(2, c)
print(min1, max1)


n = int(input())
if n > 1:
	if n % 7 == 6:
		mi = n // 7 * 2 + 1
	else:
		mi = n // 7 * 2
	if (n - 2) % 7 == 6:
		ma = (n - 2) // 7 * 2 + 3
	else:
		ma = (n - 2) // 7 * 2 + 2
	print(mi, ma)
else:
	print(0, 1)


n = int(input())
k = int(n / 7) * 2
h = n % 7
if h < 2:
	print(k, ' ', k + h)
elif h <= 5:
	print(k, ' ', k + 2)
else:
	print(k + 1, ' ', k + 2)


year = int(input())
print(year // 7 * 2 + max(0, year % 7 - 5), year // 7 * 2 + min(year % 7, 2))


n = int(input())
rem = n % 7
g = n // 7 * 2
(mi, mx) = (g, g)
if rem == 1:
	mx += 1
elif rem > 1 and rem < 6:
	mx += 2
elif rem == 6:
	mi += 1
	mx += 2
print(mi, mx)


n = int(input())
mx = n // 7 * 2 + min(n % 7, 2)
mn = n // 7 * 2 + int(n % 7 == 6)
print(mn, mx)


from math import ceil
n = int(input())
mini = 2 * (n // 7)
maxx = n // 7 * 2 + min(2, n % 7)
if n % 7 == 6:
	mini += 1
print(mini, maxx)


n = int(input())
m = n // 7
l = n - m * 7
print(m * 2 + (l == 6), m * 2 + (l > 0) + (l > 1))


i = int(input())
big = i // 7 * 2 + min(2, i % 7)
small = i // 7 * 2 + max(0, i % 7 - 5)
print(small, big)


X = int(input())
print(2 * (X // 7) if (X + 1) % 7 != 0 else 2 * (X // 7) + 1, end=' ')
print(2 * (X // 7) + X % 7 if X % 7 in [1, 2, 0] else 2 * (X // 7) + 2)


n = int(input())
remainder = n % 7
minimum = n // 7 * 2 + max(0, remainder - 5)
maximum = n // 7 * 2 + min(remainder, 2)
print(minimum, maximum)


n = int(input())
(mi, ma) = (10 ** 10, -10 ** 10)
for begin in range(min(7, n + 1)):
	rest = n - begin
	end = rest % 7
	rest -= end
	cur = min(2, begin) + rest // 7 * 2 + max(0, end - 5)
	mi = min(mi, cur)
	ma = max(ma, cur)
print(mi, ma)


n = int(input())
base = 2 * (n // 7)
more = min(n % 7, 2)
less = max(n % 7, 5) - 5
print(base + less, base + more)


n = int(input())
dmin = 0
dmax = 0

def min(n):
	if n % 7 == 6:
		dmin = n // 7 * 2 + 1
		return dmin
	elif n % 7 == 0:
		return n // 7 * 2
	else:
		dmin = n // 7 * 2
		return dmin
x = min(n)

def max(n, x):
	if n % 7 == 1:
		dmax = x + 1
		return dmax
	elif n % 7 >= 2:
		if n % 7 == 6:
			dmax = x + 1
			return dmax
		else:
			dmax = x + 2
			return dmax
	elif n % 7 == 0:
		return n // 7 * 2
y = max(n, x)
print(str(x) + ' ' + str(y))


a = int(input().strip())
min_h = 0
max_h = 0
if a <= 5:
	min_h = 0
elif a <= 7:
	min_h = a - 5
else:
	min_h = 2 * (a // 7)
	if a % 7 == 6:
		min_h += 1
if a == 1:
	max_h = 1
elif a > 1 and a <= 7:
	max_h = 2
else:
	max_h = 2 * (a // 7)
	if a % 7 == 1:
		max_h += 1
	elif a % 7 >= 2:
		max_h += 2
print(min_h, max_h)


from sys import stdin
days = int(stdin.readline())
min = 0
max = 0
tempDays = days
while days > 0:
	if days - 5 > 0:
		days -= 5
	else:
		break
	if days - 2 >= 0:
		days -= 2
		min += 2
	else:
		min += 1
		break
while tempDays > 0:
	if tempDays - 2 >= 0:
		tempDays -= 2
		max += 2
	else:
		max += 1
		break
	if tempDays - 5 > 0:
		tempDays -= 5
	else:
		break
print(str(min) + ' ' + str(max))


n = int(input())
minimum = n // 7 * 2
maximum = minimum + min(2, n % 7)
if n % 7 == 6:
	minimum += 1
print(str(minimum) + ' ' + str(maximum))


n = int(input())
ta = n // 7
la = ta * 2
da = n % 7
if da == 0:
	print(la, la)
elif da == 1:
	print(la, la + 1)
elif da > 1 and da <= 5:
	print(la, la + 2)
else:
	print(la + 1, la + 2)


import math
days = int(input())
minimum = math.floor(days / 7) * 2
if days % 7 == 6:
	minimum += 1
maximum = math.floor(days / 7) * 2
if days % 7 == 1:
	maximum += 1
else:
	maximum += 2
if days % 7 == 0:
	maximum -= 2
print(minimum, maximum)


import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
n = int(input())
w = n // 7
d = n % 7
min_off = w * 2
max_off = w * 2
if d <= 2:
	max_off += d
elif 2 < d and d <= 5:
	max_off += 2
else:
	max_off += 2
	min_off += 1
print('{} {}'.format(min_off, max_off))


q = divmod(int(input()), 7)
print(2 * q[0] + [0, 1][q[1] > 5], 2 * q[0] + min(2, q[1]))


a = int(input())
z = a // 7
x = a % 7
if x == 0:
	print(z * 2, z * 2)
elif x < 3:
	print(z * 2, z * 2 + x)
elif x > 5:
	print(z * 2 + 1, z * 2 + 2)
else:
	print(z * 2, z * 2 + 2)


n = int(input())
print(2 * (n // 7) + (1 if n % 7 == 6 else 0), 2 * (n // 7) + (n % 7 if n % 7 < 2 else 2))


a = int(input())
b = a // 7 * 2
c = a % 7
print(b + max(c - 5, 0), b + min(c, 2))


from math import floor
n = int(input())
if n == 1:
	print(0, 1)
elif n % 7 == 0:
	print(2 * n // 7, 2 * n // 7)
elif n % 7 == 1:
	print(n // 7 * 2, n // 7 * 2 + 1)
elif n % 7 == 6:
	print(n // 7 * 2 + 1, n // 7 * 2 + 2)
elif n % 7 <= 5 and n % 7 > 1:
	print(n // 7 * 2, n // 7 * 2 + 2)


from math import ceil
n = int(input())
if n < 7:
	if n == 6:
		print(1, 2)
	elif n == 1:
		print(0, 1)
	else:
		print(0, 2)
elif n % 7 == 0:
	print(n // 7 * 2, n // 7 * 2)
else:
	a = n // 7 * 2
	b = ceil((n - 2) / 7) * 2
	if n % 7 == 6:
		a += 1
	if (n - 2) % 7 == 0:
		b += 2
	elif (n - 2) % 7 == 6:
		b += 1
	print(a, b)


n = int(input())
w = n // 7
print(w * 2 + (1 if n % 7 == 6 else 0), w * 2 + min(n % 7, 2))


x = int(input())
y = x % 7
if y > 2:
	y = 2
maxx = 2 * (x // 7) + y
z = x % 7
if z == 6:
	z = 1
else:
	z = 0
minn = 2 * (x // 7) + z
print(minn, maxx)


n = int(input())
tmp = int(n % 7)
print(int(n / 7) * 2 + int(tmp / 6), end=' ')
if tmp == 1:
	print(int(n / 7) * 2 + 1)
elif tmp >= 2:
	print(int(n / 7) * 2 + 2)
else:
	print(int(n / 7) * 2)


m = int(input())
weeks = int(m / 7)
min_days_off = 2 * weeks + max(int(m % 7) - 5, 0)
max_days_off = 2 * weeks + min(2, m % 7)
print(min_days_off, max_days_off)


n = int(input())
b = n // 7 * 2
r = n % 7
if r == 6:
	M = 2 + b
	N = 1 + b
	print(N, M)
elif r >= 2:
	M = 2 + b
	N = b
	print(N, M)
else:
	M = r + b
	N = b
	print(N, M)


n = int(input())
t = n // 7
d = n % 7
if d == 0:
	print(2 * t, 2 * t)
elif d == 1:
	print(2 * t, 2 * t + 1)
elif d == 6:
	print(2 * t + 1, 2 * t + 2)
else:
	print(2 * t, 2 * t + 2)


a = int(input())
(b, c) = (a // 7 * 2, a // 7 * 2)
b += [0, 1][a % 7 == 6]
c += [a % 7, 2][a % 7 > 2]
print('%d %d' % (b, c))


daysNum = int(input())
minHolidays = daysNum // 7 * 2
maxHolidays = daysNum // 7 * 2
if daysNum % 7 == 1:
	maxHolidays += 1
elif daysNum % 7 >= 2:
	maxHolidays += 2
if daysNum % 7 == 6:
	minHolidays += 1
print(minHolidays, maxHolidays)


n = int(input())
a = n // 7
b = n % 7
if b == 0 or b == 1:
	print(a * 2, a * 2 + b)
elif b == 2 or b == 3 or b == 4 or (b == 5):
	print(a * 2, a * 2 + 2)
else:
	print(a * 2 + 1, a * 2 + 2)


x = int(input())
a = x // 7 * 2
b = 0
if x % 7 == 6:
	b = 1
c = 0
if x % 7 == 1:
	c = 1
if x % 7 > 1:
	c = 2
print(str(a + b) + ' ' + str(a + c))


n = int(input())
(q, r) = (int(n / 7), int(n % 7))
o = q * 2 + (1 if r == 6 else 0)
O = q * 2 + (r if r <= 2 else 2)
print(o, O)


n = int(input())
q = 0
cmin = 1
cmax = 6
mn = 0
mx = 0
while q < n:
	if cmin > 5:
		mn += 1
		if cmin == 7:
			cmin = 0
	if cmax > 5:
		mx += 1
		if cmax == 7:
			cmax = 0
	q += 1
	cmin += 1
	cmax += 1
print(mn, mx)


n = int(input())
if n % 7 == 0:
	p = n // 7
	print('%d %d' % (p * 2, p * 2))
else:
	p = n // 7
	s = n % 7
	if s == 1:
		print('%d %d' % (p * 2, p * 2 + 1))
	elif s == 6:
		print('%d %d' % (p * 2 + 1, p * 2 + 2))
	else:
		print('%d %d' % (p * 2, p * 2 + 2))


d = int(input())
x = d // 7
x *= 2
rem = d % 7
rem_A = 7 - rem
(Max, Min) = (0, 0)
if rem >= 2 and rem < 6:
	Max = 2
	Min = 0
if rem == 6:
	Max = 2
	Min = 1
if rem == 1:
	Max = 1
	Min = 0
if rem == 0:
	(Max, Min) = (0, 0)
print(x + Min, x + Max)


print(*(number for number in (lambda div, mod: (div * 2 + (7 - mod if 5 < mod else 0), div * 2 + (2 if mod > 1 else mod)))(*divmod(int(input()), 7))))


import sys
import math
import bisect
import itertools
import random
import re

def main():
	n = int(input())
	A = [0] * 7
	for i in range(n):
		A[i % 7] += 1
	B = []
	for i in range(7):
		j = (i + 1) % 7
		B.append(A[i] + A[j])
	print('%d %d' % (min(B), max(B)))
main()


n = int(input())
c1 = n // 7 * 2
c2 = c1
k1 = n % 7
k2 = k1 - 5
if k1 >= 2:
	c1 += 2
else:
	c1 += k1
if k2 >= 0:
	c2 += k2
print(c2, c1)


n = int(input())
a = 0
b = 0
d = n % 7
if d == 0:
	e = n // 7
	a = 2 * e
	b = 2 * e
elif n < 7:
	if d == 1:
		a = 0
		b = 1
	elif d > 1 and d < 6:
		a = 0
		b = 2
	else:
		a = 1
		b = 2
else:
	e = n // 7
	a = 2 * e
	b = 2 * e
	if d == 1:
		b += 1
	elif d < 6:
		b += 2
	else:
		a += 1
		b += 2
print(a, b)


n = int(input())
minimal = n // 7 * 2
if n % 7 == 6:
	minimal += 1
maximal = n // 7 * 2
if n % 7 == 1:
	maximal += 1
elif n % 7 > 1:
	maximal += 2
print(minimal, maximal)


n = int(input())
maxi = 0
mini = 0
if n > 1 and n <= 5:
	maxi = 2
	mini = 0
elif n == 1:
	maxi = 1
	mini = 0
elif n == 6:
	maxi = 2
	mini = 1
elif n % 7 == 0:
	ab = int(n / 7)
	maxi = ab * 2
	mini = ab * 2
else:
	ab = int(n / 7)
	rem = int(n % 7)
	if rem > 1 and rem < 6:
		maxi = ab * 2 + 2
		mini = ab * 2
	elif rem == 1:
		maxi = ab * 2 + 1
		mini = ab * 2
	elif rem == 6:
		maxi = ab * 2 + 2
		mini = ab * 2 + 1
print(mini, end=' ')
print(maxi)


from math import *
n = int(input())
zheng = int(n / 7) * 2
yu = n % 7
print('%d %d' % (zheng + (1 if yu == 6 else 0), zheng + (yu if yu < 2 else 2)))


import sys
import queue

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
rem = n % 7
d = n // 7
min = d * 2
max = d * 2
if rem == 6:
	min = min + 1
if rem > 0:
	if rem == 1:
		max = max + 1
	else:
		max = max + 2
print(min, max)


n = int(input())
m = n // 7
r = n % 7
print(str(2 * m + max(0, r - 5)) + ' ' + str(2 * m + min(r, 2)))


import sys
input = sys.stdin.buffer.readline
from math import *
n = int(input())
var = 2 * (n // 7)
mini = var + 0 if n % 7 < 6 else var + 1
maxm = var + 2 if n % 7 >= 2 else var + n % 7
print(mini, maxm)


N = int(input())
Mod = N % 7
Min = N // 7
Max = N // 7
Min = Min * 2
Max = Max * 2
if Mod == 6:
	print(Min + 1, Max + 2)
if 1 < Mod < 6:
	print(Min, Max + 2)
if Mod <= 1:
	print(Min, Max + Mod)


n = int(input())
m = n % 7
t = n // 7 * 2
if m <= 5:
	a = t
else:
	a = t + m - 5
if m <= 2:
	b = t + m
else:
	b = t + 2
print(a, b)


n = int(input())
if n % 7 == 6:
	k = 1
else:
	k = 0
p = n // 7 * 2 + k
if n % 7 == 1:
	k1 = 1
elif n % 7 >= 2:
	k1 = 2
else:
	k1 = 0
q = n // 7 * 2 + k1
print(p, q)


n = int(input().strip())
a = n // 7
a *= 2
b = n % 7
min = a
max = a
if b >= 2:
	min += 2
else:
	min += b
if b <= 5:
	max += 0
else:
	max += b - 5
print(max, min)


n = int(input())
min_days = max_days = n // 7 * 2
m = n % 7
if m == 1:
	max_days += 1
elif m > 1:
	max_days += 2
if m == 6:
	min_days += 1
print(min_days, max_days)


n = int(input())
a = n // 7
b = n % 7
c = a * 2
d = a * 2
if b < 2:
	d = d + b
else:
	d = d + 2
if b == 6:
	c = c + 1
print(c, d)


n = int(input())
a = 2 * (n // 7)
b = a
m = n % 7
if m <= 6:
	b = b + min(m, 2)
if m == 6:
	a = a + 1
print(a, b)


n = int(input())
daysleft = n % 7
ans = n // 7 * 2
if daysleft == 6:
	ans = ans + 1
aans = ans
if daysleft == 1:
	aans += 1
elif daysleft != 6 and daysleft != 0:
	aans += 2
elif daysleft == 6:
	aans += 1
print(ans, aans)


n = int(input())
yo = n // 7
ro = n % 7
if ro == 1:
	print(yo * 2, yo * 2 + 1)
elif ro == 0:
	print(yo * 2, yo * 2)
elif ro == 6:
	print(yo * 2 + 1, yo * 2 + 2)
else:
	print(yo * 2, yo * 2 + 2)


day = int(input())
max_weekands = 0
min_weekands = 0
if day % 7 == 0:
	max_weekands = day // 7 * 2
	min_weekands = day // 7 * 2
else:
	if day % 7 == 6:
		min_weekands += 1
		max_weekands += 2
	else:
		max_weekands += 2
	max_weekands += day // 7 * 2
	min_weekands += day // 7 * 2
	if day == 1 or day % 7 == 1:
		max_weekands -= 1
print(min_weekands, max_weekands)


n = int(input())
s = 2
o = 0
if n % 7 == 0:
	s = 0
if n % 7 == 1:
	s = 1
if n % 7 == 6:
	o = 1
print(n // 7 * 2 + o, n // 7 * 2 + s)


import itertools as it
import functools
import operator
import collections
import math
import sys

def lo(n):
	k = max(n - 5, 0)
	return min(2, k % 7) + 2 * (k // 7)

def solve(n):
	q = max(n - 2, 0)
	hi = lo(q) + min(2, n)
	return (lo(n), hi)

def pp(*args, **kwargs):
	return print(*args, file=sys.stderr, **kwargs)

def main():
	n = int(input())
	result = solve(n)
	print(*result)
main()


n = int(input().strip())
maxx = n // 7 * 2
minn = n // 7 * 2
if n % 7 > 1:
	maxx += 2
	if n % 7 == 6:
		minn += 1
else:
	maxx += n % 7
print(minn, maxx)


from sys import stdin, stdout
n = int(stdin.readline())
stdout.write(str(n // 7 * 2 + max(n % 7, 5) - 5) + ' ' + str(n // 7 * 2 + min(2, n % 7)))


n = int(input())
ans = n // 7 * 2
n %= 7
print(ans + max(0, n - 5), ans + min(2, n))


n = int(input())
min = 0
max = 0
for i in range(1, n + 1):
	if i % 7 == 1 or i % 7 == 2:
		max += 1
	if i % 7 == 6 or i % 7 == 0:
		min += 1
print(min, max)


n = int(input(''))
s = int(n / 7)
a = int(n % 7)
m = 0
if a == 6:
	m = 1
if a >= 2:
	xx = 2
elif a == 1:
	xx = 1
else:
	xx = 0
num = s * 2
print(str(num + m) + ' ' + str(num + xx))


n = int(input())
w = n // 7
r = n % 7
mn = mx = 2 * w
mx += min(2, r)
mn += r == 6
print(mn, mx)


n = int(input())
a = divmod(n, 7)[0]
b = divmod(n, 7)[1]
if b <= 2:
	print(a * 2, a * 2 + b)
elif b > 2 and b <= 5:
	print(a * 2, a * 2 + 2)
else:
	print(a * 2 + b - 5, a * 2 + 2)


days = int(float(input()))
weeks = int(days / 7)
remains = days % 7
maxOff = weeks * 2
minOff = weeks * 2
maxOff += remains > 2 and 2 or remains
minOff += remains > 5 and remains - 5 or 0
print('%s %s' % (minOff, maxOff))


n = int(input())
if True:
	low = int(n // 7) * 2
	high = int((n + 5) // 7) * 2
	if n % 7 == 6:
		low += 1
	if n % 7 == 1:
		high += 1
	print(low, high)


n = int(input())
mm = mi = n // 7 * 2
if n % 7:
	mm += min(n % 7, 2)
if n % 7 == 6:
	mi += 1
print(mi, mm)


from math import ceil
n = int(input())
x = n // 7
if n % 7 == 1:
	print(x * 2, x * 2 + 1)
elif n % 7 == 6:
	print(x * 2 + 1, x * 2 + 2)
elif n % 7 == 0:
	print(x * 2, x * 2)
else:
	x = n // 7
	s = ceil(n / 7)
	print(x * 2, s * 2)


inp = int(input())
ma = inp % 7 if inp % 7 < 2 else 2
mi = max(inp % 7 - 5, 0)
print(str(int(inp / 7) * 2 + mi) + ' ' + str(int(inp / 7) * 2 + ma))


x = int(input())
d = 0
c = 2
a = x // 7
b = abs(7 * a - x)
if b == 0:
	(c, d) = (0, 0)
elif b == 6:
	d = 1
elif b == 1:
	c = 1
mih = 2 * a + d
mah = 2 * a + c
print(mih, mah)


n = int(input())
week_num = n // 7
print(week_num * 2 + max(n % 7 - 5, 0), week_num * 2 + min(n % 7, 2))


n = int(input())
a = int(n / 7) * 2
a1 = a
b = n % 7
if b <= 1:
	a += b
else:
	a += 2
if b == 6:
	a1 += 1
print(a1, a, sep=' ')


n = int(input())
if n < 6:
	print(0, end=' ')
elif n % 7 == 6:
	print(n // 7 * 2 + 1, end=' ')
else:
	print(n // 7 * 2, end=' ')
if n < 3:
	print(n)
else:
	ans = 2
	n -= 2
	if n % 7 == 6:
		ans += n // 7 * 2 + 1
	else:
		ans += n // 7 * 2
	print(ans)


n = int(input())
first = n // 7 * 2
second = n // 7 * 2
if n % 7 == 6:
	first += 1
if n % 7 >= 2:
	second += 2
elif n % 7 == 1:
	second += 1
print(first, second)


n = int(input())
d = int(n / 7)
r = n % 7
vmin = 2 * d
vmax = 2 * d + min(2, r)
if r == 6:
	vmin = vmin + 1
print(vmin, vmax)


n = int(input())
ndiv = int(n / 7)
nmod = int(n % 7)
maximum = ndiv * 2
manimum = ndiv * 2
if nmod > 0:
	if nmod == 1:
		maximum = maximum + 1
	else:
		maximum = maximum + 2
		if nmod == 6:
			manimum = manimum + 1
print(manimum, ' ', maximum)


n = input('')
n = int(n)
min = 0
j = n % 7
max = n // 7 * 2
min = n // 7 * 2
if j is 1:
	max += 1
if j >= 2:
	max += 2
if j is 6:
	min += 1
print(min, max)


n = int(input(''))
max_off = 'OOWWWWW'
min_off = 'WWWWWOO'

def make_year(year, schedule):
	days = ''
	index = 0
	for day in range(year):
		days += schedule[index]
		index += 1
		if index == 7:
			index = 0
	return days.count('O')
print(make_year(n, min_off), make_year(n, max_off))


def hd_ext_max(days):
	return days if days < 2 else 2

def hd_ext_min(days):
	return 1 if days == 6 else 0

def main():
	days_num = int(input())
	full_weeks_num = days_num // 7
	min_hd = full_weeks_num * 2 + hd_ext_min(days_num % 7)
	max_hd = min_hd + hd_ext_max(days_num % 7) - hd_ext_min(days_num % 7)
	print(min_hd, max_hd)
main()


n = int(input())
w = n // 7
o = n % 7
mini = 0
maxi = 0
if w > 0:
	mini = w * 2 + max(0, o - 5)
	maxi = w * 2 + min(2, o)
elif o > 5:
	maxi = 2
	mini = o - 5
else:
	maxi = min(2, o)
print('{0} {1}'.format(mini, maxi))


n = int(input())
week = n // 7
days = n % 7
(mx, mn) = (2 * week, 2 * week)
mx += min(days, 2)
mn += days - min(days, 5)
print(mn, mx)


n = int(input())
if n <= 7:
	a = 0
	ost = n
else:
	a = int(n / 7) * 2
	ost = n % 7
if ost == 0:
	print(a, a)
elif ost == 1:
	print(a + 0, a + 1)
elif ost == 2 or ost == 3 or ost == 4 or (ost == 5):
	print(a + 0, a + 2)
elif ost == 6:
	print(a + 1, a + 2)
elif ost == 7:
	print(a + 2, a + 2)


n = int(input())
mod = n % 7
maxi = n // 7 * 2 + min(2, n % 7)
mini = n // 7 * 2 + max(n % 7 - 5, 0)
print(mini, maxi)


n = int(input())
x = n // 7
y = n % 7
print(2 * x + max(0, y - 5), 2 * x + min(y, 2))


n = int(input())
t1 = n // 7 * 2
t2 = 0
if n % 7 == 1:
	t2 = 1
elif n % 7 >= 2:
	t2 = 2
if n % 7 == 6:
	t1 += 1
	t2 -= 1
print(t1, t1 + t2)


x = int(input())
y = int(x / 7)
z = x - y * 7
y = y * 2
if z > 5:
	y = y + 1
	z = 1
elif z > 1:
	z = 2
print(y, y + z)


n = int(input())
weeks = n // 7
max_days = weeks * 2 + min(2, n % 7)
min_days = weeks * 2 + max(0, n % 7 - 5)
print(min_days, max_days)


n = int(input())
ints = 2 * (n // 7)
if n % 7 == 6:
	maximum = ints + 2
	minimum = ints + 1
elif n % 7 == 0:
	maximum = ints
	minimum = ints
elif n % 7 == 1:
	maximum = ints + 1
	minimum = ints
else:
	maximum = ints + 2
	minimum = ints
print(minimum, maximum)


n = int(input())
maxholy = min(n, 2)
n1 = max(0, n - 2)
maxholy += n1 // 7 * 2
maxholy += min(max(0, n1 % 7 - 5), 2)
minholy = n // 7 * 2
minholy += min(max(0, n % 7 - 5), 2)
print(minholy, maxholy)


n = int(input())
a = n - 5
print(a // 7 * 2 + min(2, a % 7), n // 7 * 2 + min(2, n % 7))


n = int(input())
(M, m) = [0, 0]
for ii in range(n):
	i = ii % 7
	if i == 1 or i == 0:
		M += 1
	elif i == 5 or i == 6:
		m += 1
print(m, M)


n = int(input())
ost = n % 7
weaks = n // 7
if ost == 0:
	print(n // 7 * 2, n // 7 * 2)
elif ost == 1:
	print(weaks * 2, weaks * 2 + 1)
elif ost >= 2 and ost <= 5:
	print(weaks * 2, weaks * 2 + 2)
else:
	print(weaks * 2 + 1, weaks * 2 + 2)


n = int(input())
ans = n // 7 * 2
n %= 7
hi = [0, 1, 2, 2, 2, 2, 2]
lo = [0, 0, 0, 0, 0, 0, 1]
print(ans + lo[n], ans + hi[n])


n = int(input())
x = 0
if n % 7 == 6:
	x = 1
mi = n // 7 * 2
y = min(2, n % 7)
print('{} {}'.format(mi + x, mi + y))


def makeMax(n):
	st = ''
	res = 0
	while n > 0:
		c1 = 0
		while c1 != 2 and n > 0:
			res += 1
			n -= 1
			c1 += 1
		c1 = 0
		while c1 != 5 and n > 0:
			c1 += 1
			n -= 1
	return res

def makeMin(n):
	res = 0
	while n > 0:
		c1 = 0
		while c1 != 5 and n > 0:
			c1 += 1
			n -= 1
		c1 = 0
		while c1 != 2 and n > 0:
			res += 1
			n -= 1
			c1 += 1
	return res
n = int(input())
print(makeMin(n), makeMax(n))


n = int(input())
mi = n // 7 * 2
mx = mi
r = n % 7
if r == 0:
	pass
elif r == 1:
	mx = mx + 1
elif r < 6:
	mx = mx + 2
else:
	mx = mx + 2
	mi = mi + 1
print(mi, mx)


n = int(input())
if n == 1:
	print('0 1')
elif n == 2:
	print('0 2')
else:
	d = n - 5
	minDay = d // 7 * 2 + (2 if d % 7 >= 2 else d % 7)
	maxDay = n // 7 * 2 + (2 if n % 7 >= 2 else n % 7)
	print('%d %d' % (minDay, maxDay))


n = int(input())
res = 0
if n % 7 == 6:
	res += 1
print(2 * (n // 7) + res, 2 * (n // 7) + min(2, n % 7))


import sys
n = int(sys.stdin.readline())
minimum_days_off = n // 7 * 2 + max(n % 7 - 5, 0)
maximum_days_off = n // 7 * 2 + min(n % 7, 2)
print(minimum_days_off, maximum_days_off)


n = int(input())
ans = n // 7 * 2
f_a = n % 7
b = ans
m = ans
if f_a > 1:
	m += 2
else:
	m += f_a
if f_a == 6:
	b += 1
elif f_a == 7:
	b += 2
print(b, m)


n = int(input())
m = n // 7 * 2 + int(n % 7 > 5)
d = (n // 7 * 2 + n % 7, n // 7 * 2 + 2)[n % 7 > 1]
print(m, d)


n = int(input())
left = n % 7
minn = maxx = (n - left) // 7 * 2
if left == 6:
	minn += 1
print(minn, maxx + min(left, 2))


n = int(input())
if n % 7 == 0:
	print(n * 2 // 7, n * 2 // 7)
elif n % 7 > 5:
	print(n // 7 * 2 + 1, n // 7 * 2 + 2)
else:
	print(n // 7 * 2, n // 7 * 2 + min(n % 7, 2))


def year(start, n):
	daysoff = 0
	days = ['dom', 'seg', 'ter', 'quar', 'quin', 'sex', 'sab'] * 1000000
	for x in range(start, start + n):
		if days[x] == 'dom':
			daysoff += 1
		elif days[x] == 'sab':
			daysoff += 1
		else:
			continue
	return daysoff
n = int(input())
print(year(1, n), year(6, n))


n = int(input())
f = lambda x: x // 7 * 2 + x % 7 // 6
print(f(n), min(2, n) + f(max(n - 2, 0)))


n = int(input())
small = n // 7 * 2
large = n % 7
if large < 2:
	print(small, small + large)
elif large <= 5:
	print(small, small + 2)
else:
	print(small + 1, small + 2)


from math import ceil as c
n = int(input())
if n == 1:
	print(0, 1)
elif n < 6:
	print(0, 2)
elif n == 6:
	print(1, 2)
else:
	x = c(n / 7) * 7 - n
	print(c(n / 7) * 2 - min(2, x), n // 7 * 2 + min(2, n % 7))


n = int(input())
a = 0
if n > 7:
	a = n % 7
	if a == 0:
		print(2 * (n // 7), 2 * (n // 7))
	elif a < 3:
		print(2 * (n // 7), 2 * (n // 7) + a)
	elif a >= 3 and a <= 5:
		print(2 * (n // 7), 2 * (n // 7) + 2)
	elif a == 6:
		print(2 * (n // 7) + 1, 2 * (n // 7) + 2)
elif n < 7:
	if n == 1:
		print(0, 1)
	elif n >= 1 and n <= 5:
		print(0, 2)
	elif n == 6:
		print(1, 2)
else:
	print(2, 2)


n = int(input())
kol = 2 * (n // 7)
cur = n % 7
print(kol + max(cur - 5, 0), kol + min(2, cur))


days = int(input())
dmax = 0
dmin = 0
w = days
while w >= 0:
	w -= 7
	if w >= 0:
		dmin += 2
		dmax += 2
	elif w > -7:
		if w == -1:
			dmax += 2
			dmin += 1
		elif w == -6:
			dmax += 1
		elif w >= -5:
			dmax += 2
print(dmin, dmax)


def solve(n):
	res = n // 7 * 2
	d = n % 7
	if d == 6:
		minn = res + 1
		maxx = res + 2
	elif d == 1:
		minn = res
		maxx = res + 1
	elif d == 0:
		minn = res
		maxx = res
	else:
		minn = res
		maxx = res + 2
	return [minn, maxx]
n = int(input())
sol = solve(n)
print(str(sol[0]) + ' ' + str(sol[1]))


import math, fractions, collections
n = int(input())
print(n // 7 * 2 + n % 7 // 6, n // 7 * 2 + min(n % 7, 2))


n = int(input())
mn = 2 * (n // 7)
t = n % 7
if t == 0:
	print(mn, mn)
elif t == 1:
	print(mn, mn + 1)
elif 2 <= t <= 5:
	print(mn, mn + 2)
elif t == 6:
	print(mn + 1, mn + 2)
else:
	exit(100500)


n = int(input())
result = n // 7 * 2
print(result + max(0, n % 7 - 5), end=' ')
print(result + min(2, n % 7))


n = int(input())
minans = 0
maxans = 0
i = 0
j = 2
for d in range(n):
	if i % 7 <= 1:
		maxans += 1
	if j % 7 <= 1:
		minans += 1
	i = (i + 1) % 7
	j = (j + 1) % 7
print(minans, maxans)


i = int(input())
if i % 7 == 0:
	print(i // 7 * 2, i // 7 * 2)
elif i % 7 == 1:
	print(i // 7 * 2, i // 7 * 2 + 1)
elif i % 7 == 6:
	print(i // 7 * 2 + 1, i // 7 * 2 + 2)
else:
	print(i // 7 * 2, i // 7 * 2 + 2)


n = int(input())
m = n
offmin = offmax = 0
while 1:
	if n <= 2:
		offmax += n
		break
	else:
		offmax += 2
		n -= 2
	if n <= 5:
		break
	else:
		n -= 5
while 1:
	if m <= 5:
		break
	else:
		m -= 5
	if m <= 2:
		offmin += m
		break
	else:
		offmin += 2
		m -= 2
print(offmin, offmax)


n = int(input())
if n % 7 == 0:
	xMax = n // 7 * 2
	xMin = xMax
else:
	xMin = n // 7 * 2
	xMax = xMin + 2
	if n % 7 == 6:
		xMin = xMin + 1
	if n % 7 == 1:
		xMax = xMax - 1
print(xMin, xMax)


from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
import math
import string
import itertools
import fractions
import heapq
import collections
import re
import array
import bisect
n = int(input())
w = n // 7
d = n % 7
min_off = w * 2
max_off = w * 2
if d <= 2:
	max_off += d
elif 2 < d and d <= 5:
	max_off += 2
else:
	max_off += 2
	min_off += 1
print('{} {}'.format(min_off, max_off))


n = int(input())
a = 2 * (n // 7)
b = n % 7
print(a + (b == 6), a + min(2, b))


n = int(input())
if n % 7 == 1:
	min1 = 0
	max1 = 1
	for i in range(0, n - 1, 7):
		min1 = min1 + 2
		max1 = max1 + 2
	print(min1, max1)
if n % 7 == 2 or n % 7 == 3 or n % 7 == 4 or (n % 7 == 5):
	min1 = 0
	max1 = 2
	for i in range(7, n - 1, 7):
		min1 = min1 + 2
		max1 = max1 + 2
	print(min1, max1)
if n % 7 == 6:
	min1 = 1
	max1 = 2
	for i in range(7, n - 1, 7):
		min1 = min1 + 2
		max1 = max1 + 2
	print(min1, max1)
if n % 7 == 0:
	min1 = 0
	max1 = 0
	for i in range(0, n - 1, 7):
		min1 = min1 + 2
		max1 = max1 + 2
	print(min1, max1)


n = int(input())
w = n // 7
y = n % 7
if y >= 2 and y != 6:
	print(2 * w, 2 * w + 2)
elif y == 6:
	print(2 * w + 1, 2 * w + 2)
else:
	print(2 * w, 2 * w + y)


def main():
	n = int(input())
	s1 = n // 7 * 2
	if n % 7 == 6:
		s1 += 1
	s2 = n // 7 * 2
	if n % 7 == 1:
		s2 += 1
	elif n % 7 >= 2:
		s2 += 2
	print(s1, s2)
main()


n = int(input())
maxx = int(n / 7) * 2 + (n % 7 if n % 7 in [0, 1, 2] else 2)
n = n - 5 if n > 5 else 0
print(int(n / 7) * 2 + (n % 7 if n % 7 in [0, 1, 2] else 2), maxx)


n = int(input())
t = n
mn = 0
mx = 0
while t:
	if t == 1:
		mx += 1
		break
	elif t >= 2:
		t -= 2
		mx += 2
	if t > 5:
		t -= 5
	else:
		break
t = n
while t:
	if t <= 5:
		break
	else:
		t -= 5
	if t >= 2:
		t -= 2
		mn += 2
	elif t < 2:
		mn += t
		break
print(mn, mx)


n = int(input())
mx = n // 7 * 2 + min(n % 7, 2)
mn = n // 7 * 2 + max(n % 7 - 5, 0)
print(mn, mx)


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
mi = 2 * (n // 7) + int(n % 7 == 6)
ma = 2 * (n // 7) + int(n % 7 > 0) + int(n % 7 > 1)
print(mi, ma)


import math
n = int(input())
cel = math.floor(n / 7)
ost = n % 7
if ost <= 2:
	max_weekend = cel * 2 + ost
else:
	max_weekend = cel * 2 + 2
if ost < 6:
	min_weekend = cel * 2
else:
	min_weekend = cel * 2 + 7 - ost
print(min_weekend, max_weekend)


def count_weekends(n):
	min_weekends = 0
	max_weekends = 0
	for i in range(1, n + 1):
		if i % 7 == 6 or i % 7 == 0:
			min_weekends += 1
		if i % 7 == 1 or i % 7 == 2:
			max_weekends += 1
	return '%d %d' % (min_weekends, max_weekends)
n = int(input())
print(count_weekends(n))


N = int(input())
print(N // 7 * 2 + max(0, N % 7 - 5), N // 7 * 2 + min(N % 7, 2))


import math

def get_primes(prime_supr):
	is_prime = [0] * 2 + [1] * prime_supr
	for i in range(2, int(math.sqrt(prime_supr)) + 1):
		if is_prime[i]:
			for j in range(i * i, prime_supr + 1, i):
				is_prime[j] = 0
	return is_prime
get_int = lambda : map(int, input().split())
n = int(input())
ans = n // 7 * 2
n -= 7 * (ans // 2)
if n == 1:
	print(ans, ans + 1)
elif n == 6:
	print(ans + 1, ans + 2)
elif n == 0:
	print(ans, ans)
else:
	print(ans, ans + 2)


n = int(input())
s = n // 7 * 2
if n % 7 != 6:
	print(s, end=' ')
else:
	print(s + 1)
if n % 7 == 0:
	print(s)
elif n % 7 == 1:
	print(s + 1)
else:
	print(s + 2)


n = int(input())
approx_off_days = 2 * (n // 7)
excess_days = n % 7
print(f'{approx_off_days + max(0, excess_days - 5)} {approx_off_days + min(2, excess_days)}')


import sys
n = int(input())
k = n // 7
if n % 7 == 0:
	print(k * 2, end=' ')
elif n % 7 == 6:
	print(max(k * 2 + 1, 0), end=' ')
else:
	print(max(k * 2, 0), end=' ')
if n % 7 == 0:
	print(k * 2)
elif n % 7 == 1:
	print(k * 2 + 1)
else:
	print(k * 2 + 2)


n = int(input())
div = int(n / 7)
rem = n % 7
if rem == 0:
	minimum = div * 2
	maximum = div * 2
elif rem == 1 or rem == 2:
	minimum = div * 2
	maximum = div * 2 + rem
elif rem == 3 or rem == 4 or rem == 5:
	minimum = div * 2
	maximum = div * 2 + 2
elif rem == 6:
	minimum = div * 2 + 1
	maximum = div * 2 + 2
print(minimum, maximum)


n = int(input())
ma = n // 7 * 2
mi = n // 7 * 2
if n % 7 <= 5 and n % 7 >= 2:
	ma += 2
elif n % 7 == 1:
	ma += 1
elif n % 7 == 6:
	ma += 2
	mi += 1
print(mi, ma)


import sys
n = int(input())
if n % 7 == 0:
	print(n // 7 * 2, n // 7 * 2)
elif n % 7 == 1:
	print(n // 7 * 2, n // 7 * 2 + 1)
elif n % 7 != 6:
	print(n // 7 * 2, n // 7 * 2 + 2)
else:
	print(n // 7 * 2 + 1, n // 7 * 2 + 2)


n = int(input())
if n % 7 == 0:
	maximum = n / 7 * 2
	minimum = maximum
elif n % 7 == 1:
	minimum = n // 7 * 2
	maximum = minimum + 1
elif n % 7 == 2:
	minimum = n // 7 * 2
	maximum = minimum + 2
elif n % 7 == 3:
	minimum = n // 7 * 2
	maximum = minimum + 2
elif n % 7 == 4:
	minimum = n // 7 * 2
	maximum = minimum + 2
elif n % 7 == 5:
	minimum = n // 7 * 2
	maximum = minimum + 2
elif n % 7 == 6:
	minimum = n // 7 * 2
	maximum = minimum + 2
	minimum += 1
print(int(minimum), int(maximum))


n = int(input())
a = 0
b = 0
k = 1
for i in range(n):
	if k > 7:
		k = 1
	if k > 5:
		a += 1
	k += 1
k = 6
for i in range(n):
	if k > 7:
		k = 1
	if k > 5:
		b += 1
	k += 1
print(a, b)


x = int(input())
if x == 1:
	print(0, 1)
elif x > 1 and x <= 5:
	print(0, 2)
else:
	t = min(2, (x - 5) % 7)
	if (x - 2) % 7 == 6:
		print(2 * ((x - 5) // 7) + t, 2 * ((x - 2) // 7) + 3)
	else:
		print(2 * ((x - 5) // 7) + t, 2 * ((x - 2) // 7) + 2)


n = int(input())
fullWeek = n // 7
n %= 7
print(fullWeek * 2 + max(0, n - 5), fullWeek * 2 + min(2, n))


r = int(input())
n = r // 7 * 2
r %= 7
print(n + max(0, r - 5), n + min(2, r))


n = int(input())
if n <= 2:
	print(0, n)
elif n <= 5:
	print(0, 2)
elif n == 6:
	print(1, 2)
elif n == 7:
	print(2, 2)
else:
	additional_max = 0
	if (n - 2) % 7 == 6:
		additional_max = 1
	max = 2 + (n - 2) // 7 * 2 + additional_max
	additional_min = 0
	if (n - 5) % 7 == 1:
		additional_min = 1
	elif (n - 5) % 7 > 1:
		additional_min = 2
	min = (n - 5) // 7 * 2 + additional_min
	print(min, max)


z = int(input())
lst = []
c = 0
b = 0
x = z // 7
if 7 * (x + 1) - z < 2:
	c += 1
lst.append(c + x * 2)
if z % 7 > 1:
	b += 2
elif z % 7 < 2 and z % 7 != 0:
	b += 1
lst.append(b + x * 2)
print(*sorted(lst))


n = int(input())
f = lambda x: x if x <= 2 else 2
print(2 * (n // 7) + n % 7 // 6, 2 * (n // 7) + f(n % 7))


n = int(input())
print(n // 7 * 2 + (1 if n % 7 > 5 else 0), n // 7 * 2 + (2 if n % 7 >= 2 else n % 7))


a = int(input())
print([a // 7 * 2, a // 7 * 2 + 1][a % 7 == 6], a // 7 * 2 + [2, a % 7][a % 7 <= 1])


n = int(input())
f = n // 7
g = n % 7
s = []
if g == 6:
	s.append(f * 2 + 1)
else:
	s.append(f * 2)
if g <= 2:
	s.append(f * 2 + g)
else:
	s.append(f * 2 + 2)
for i in s:
	print(i, end=' ')


n = int(input())
i = [i % 7 for i in range(n)]
print(i.count(5) + i.count(6), i.count(0) + i.count(1))


n = int(input())
k = n % 7
print(2 * (n // 7) + int([0, 1][k > 5]), 2 * (n // 7) + int([0, 1, 2, 2, 2, 2, 2][k]), end=' ')


class codeforces:

	def holidays(self, n):
		ans = int(n / 7) * 2
		if n % 7 >= 2:
			max = ans + 2
		else:
			max = ans + n % 7
		if n % 7 > 5:
			min = ans + n % 7 - 5
		else:
			min = ans
		print(int(min), int(max))
n = int(input())
s = codeforces()
s.holidays(n)


n = int(input())
rez = n // 7 * 2
rem = n % 7
if rem == 6:
	print(str(rez + 1) + ' ' + str(rez + 2))
elif rem == 1:
	print(str(rez) + ' ' + str(rez + 1))
elif rem:
	print(str(rez) + ' ' + str(rez + 2))
else:
	print(str(rez) + ' ' + str(rez))


n = int(input())
p = n // 7 * 2
n %= 7
if n == 6:
	print(p + 1, p + 2)
elif n == 1 or n == 0:
	print(p, p + n)
else:
	print(p, p + 2)


n = int(input())
m = n // 7
n %= 7
ma = m * 2 + min(n, 2)
mi = m * 2
if n > 5:
	mi += n - 5
print(mi, ma)


n = int(input())
mi = n
ma = 0
for i in range(7):
	g = 0
	t = i
	for j in range(n):
		if t >= 5:
			g += 1
		t += 1
		if t == 7:
			t = 0
	mi = min(mi, g)
	ma = max(ma, g)
print(mi, ma)


def f(n):
	return n // 7 + (n + 1) // 7
try:
	while True:
		n = int(input())
		if n == 1:
			print('0 1')
		else:
			print(f(n), 2 + f(n - 2))
except EOFError:
	pass


import sys
import math
import string

class A:

	def __init__(self, days):
		self.days = int(days)

	def get_days(self):
		return self.days

	def get_binary(self):
		return int(math.ceil(self.days / 7.0) + 1) * '0 0 0 0 0 1 1 '

	def get_binary_array(self, binary):
		return [binary.strip().split(' ')[0:self.days], binary.strip().split(' ')[1:self.days + 1], binary.strip().split(' ')[2:self.days + 2], binary.strip().split(' ')[3:self.days + 3], binary.strip().split(' ')[4:self.days + 4], binary.strip().split(' ')[5:self.days + 5], binary.strip().split(' ')[6:self.days + 6]]

	def count_binary(self, binary):
		arr = []
		for b in binary:
			arr.append(b.count('1'))
		return arr
days = str(sys.stdin.read())
a = A(days)
binary = a.get_binary()
binary = a.get_binary_array(binary)
binary = a.count_binary(binary)
print(str(min(binary)) + ' ' + str(max(binary)))


n = int(input())
if n <= 5:
	print(0, min(n, 2))
elif n == 6:
	print(1, 2)
else:
	c = n % 7
	min1 = 2 * (n // 7) + max(0, n % 7 - 5)
	max1 = 2 * (n // 7) + min(2, c)
	print(min1, max1)


N = int(input())
if N % 7 == 1:
	print(int(int(N / 7) * 2))
	print(int(int(N / 7) * 2 + 1))
elif N % 7 > 1 and N % 7 != 6:
	print(int(N / 7) * 2, end=' ')
	print(int(int(N / 7) * 2 + 2))
elif N % 7 == 0:
	print(int(int(N / 7) * 2), end=' ')
	print(int(int(N / 7) * 2))
elif N % 7 == 6:
	print(int(int(N / 7) * 2 + 1), end=' ')
	print(int(int(N / 7) * 2 + 2))


n = int(input())
d = 0
c = 0
if n % 7 == 1:
	d = 1
elif n % 7 >= 2:
	d = 2
if (n + 1) % 7 == 0:
	c = 1
print(2 * (n // 7) + c, 2 * (n // 7) + d)


def main():
	n = int(input())
	weeks = n // 7
	extra = n % 7
	mx = mn = weeks * 2
	mn += max(extra - 5, 0)
	mx += min(extra, 2)
	print('%d %d' % (mn, mx))
main()


n = int(input())
t = int(n / 7)
m = n % 7
if m <= 2:
	x = 2 * t + m
	y = 2 * t
elif 3 <= m <= 5:
	x = 2 * t + 2
	y = 2 * t
else:
	x = 2 * t + 2
	y = 2 * t + m - 5
print(y, x)


n = int(input())
cntmin = 0
cntmax = 0
if n % 7 == 0:
	cntmax = cntmin = n // 7 * 2
elif n % 7 == 6:
	cntmax = (n + 1) // 7 * 2
	cntmin = cntmax - 1
elif n % 7 == 1:
	cntmin = n // 7 * 2
	cntmax = n // 7 * 2 + 1
else:
	cntmin = n // 7 * 2
	cntmax = n // 7 * 2 + 2
print(cntmin, cntmax)


i = int(input())
var1 = i // 7 * 2
var2 = i // 7 * 2
var3 = var1 + min(2, i % 7)
var4 = var2 + max(0, i % 7 - 5)
print(var4, var3)


def solve(n):
	if n <= 7:
		return (max(0, n - 5), min(n, 2))
	else:
		return tuple(map(lambda m: 2 * (n // 7) + m, solve(n % 7)))
n = int(input())
(a, b) = solve(n)
print(a, b)


import collections, itertools, fractions, functools, heapq, math, queue

def solve():
	n = int(input())
	cnt = collections.Counter([i % 7 for i in range(n)])
	Min = n
	Max = 0
	for saturday in range(7):
		sunday = (saturday + 1) % 7
		off = cnt[saturday] + cnt[sunday]
		Min = min(Min, off)
		Max = max(Max, off)
	return (Min, Max)
print(*solve())


days = int(input())
max = []
min = []
for i in range(1, days + 1, 7):
	max.append(i)
	if i + 1 <= days:
		max.append(i + 1)
	if i + 5 <= days:
		min.append(i + 5)
	if i + 5 + 1 <= days:
		min.append(i + 5 + 1)
print(len(min), end=' ')
print(len(max), end='')


n = int(input())
if n % 7 < 2:
	print(n // 7 * 2, n // 7 * 2 + n % 7)
elif n % 7 == 6:
	print(n // 7 * 2 + 1, n // 7 * 2 + 2)
else:
	print(n // 7 * 2, n // 7 * 2 + 2)


n = int(input())
minimo = n // 7 * 2
maximo = n // 7 * 2
resto = n % 7
if resto < 2:
	maximo += resto
else:
	maximo += 2
if resto == 6:
	minimo += 1
print(minimo, maximo)


t = int(input())
dem = t // 7 * 2
t %= 7
if t > 5:
	print(dem + t - 5, dem + 2)
elif t > 2:
	print(dem, dem + 2)
else:
	print(dem, dem + t)


n = int(input())
r1 = 2 * int(n / 7)
if n % 7 > 5:
	r1 = r1 + (n % 7 - 5)
r2 = 2 * int(n / 7)
if n % 7 > 0 and n % 7 <= 2:
	r2 = r2 + n % 7
if n % 7 > 2:
	r2 = r2 + 2
print(r1, r2)


a = int(input())
print(2 * (a // 7) if a % 7 != 6 else 2 * (a // 7) + 1, end=' ')
print(2 * (a // 7) + min(2, a % 7))


n = int(input())
print(2 * int(n // 7) + (n % 7 == 6), ' ', 2 * int(n // 7) + (n % 7 >= 1) + (n % 7 >= 2), '\n')


n = input()
n = int(n)
mx = n // 7 * 2
mi = n // 7 * 2
rem = n % 7
mx += min(rem, 2)
if rem == 6:
	mi += 1
print(mi, mx)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def find_holidays(n):
	cnt = 2 * (n // 7)
	rem = n % 7
	mx = mn = cnt
	if rem == 1:
		mx += 1
	elif rem > 1:
		mx += 2
	if rem == 6:
		mn += 1
	print(mn, mx)
t = 1
while t:
	t = t - 1
	(k, g) = (0, 0)
	points = []
	n = int(input())
	find_holidays(n)


n = int(input())
minimum = n // 7 * 2 + (n % 7 - 5 if n % 7 - 5 > 0 else 0)
maximum = 2 + (n - 2) // 7 * 2 + ((n - 2) % 7 - 5 if (n - 2) % 7 - 5 > 0 else 0)
print(minimum, ' ', maximum)


def single_integer():
	return int(input())

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

def string():
	return input()

def multi_string():
	return input().split()
n = single_integer()
ans = n // 7 * 2
if n % 7 == 0:
	print(ans, ans)
elif n % 7 == 1:
	print(ans, ans + 1)
elif n % 7 == 6:
	print(ans + 1, ans + 2)
else:
	print(ans, ans + 2)


n = int(input())
k = round((n - n % 7) / 7) * 2
n = n % 7
if n == 6:
	print(k + 1, k + 2)
elif n > 1:
	print(k, k + 2)
elif n == 1:
	print(k, k + 1)
else:
	print(k, k)


n = int(input())
x = n // 7 * 2
ans = x
if n % 7 == 6:
	ans += 1
x += min(n % 7, 2)
print(ans, x)


n = int(input())
p = n % 7
if p >= 6:
	a = 7 - p
else:
	a = 0
if p >= 2:
	b = 2
else:
	b = p
print(n // 7 * 2 + a, n // 7 * 2 + b)


n = int(input())
m = n // 7 * 2 + (n % 7 == 6)
M = n // 7 * 2 + (n % 7 == 1) + (n % 7 >= 2) * 2
print('{} {}'.format(m, M))


n = int(input())
check = 0
ans = n // 7
if n % 7 == 0:
	print(ans * 2, ans * 2)
	check = 1
elif n % 7 == 1:
	maxi = ans * 2 + 1
elif n % 7 == 2:
	maxi = ans * 2 + 2
else:
	maxi = ans * 2 + 2
if check == 0:
	if n % 7 == 6:
		print(ans * 2 + 1, maxi)
	else:
		print(ans * 2, maxi)


def translation():
	word_1 = input()
	word_2 = input()[::-1]
	print(['NO', 'YES'][word_1 == word_2])
	return

def anton_and_danik():
	games = int(input())
	wins = input()
	anton_wins = sum((i == 'A' for i in wins))
	if anton_wins * 2 > len(wins):
		print('Anton')
	elif anton_wins * 2 == len(wins):
		print('Friendship')
	else:
		print('Danik')
	return

def acoomodation():
	cnt = 0
	for _ in range(int(input())):
		(p, q) = map(int, input().split())
		if q - p >= 2:
			cnt += 1
	print(cnt)
	return

def juicer():
	(n, b, d) = map(int, input().split())
	sum_orange = 0
	cnt_empty = 0
	for orange in list(map(int, input().split())):
		if orange <= b:
			sum_orange += orange
			if sum_orange > d:
				cnt_empty += 1
				sum_orange = 0
	print(cnt_empty)
	return

def digit_game():
	for game in range(int(input())):
		breach_odd_cnt = 0
		breach_even_cnt = 0
		raze_odd_cnt = 0
		raze_even_cnt = 0
		n = int(input())
		number = input()
		breach_numbers = ''
		raze_numbers = ''
		len_number = len(number)
		idx = 1
		for digit in number:
			if idx % 2 == 0:
				breach_numbers += digit
				if digit in '13579':
					breach_odd_cnt += 1
				else:
					breach_even_cnt += 1
			else:
				raze_numbers += digit
				if digit in '13579':
					raze_odd_cnt += 1
				else:
					raze_even_cnt += 1
			idx += 1
		if len_number == 1:
			if int(number) % 2 == 0:
				print(2)
			else:
				print(1)
		elif len_number % 2 == 0:
			if breach_even_cnt >= 1:
				print(2)
			else:
				print(1)
		elif raze_odd_cnt >= 1:
			print(1)
		else:
			print(2)
	return

def modular_exponentiation():
	n = int(input())
	m = int(input())
	calc = m % int(1 << n)
	print(int(calc))
	return

def tricky_sum():
	for _ in range(int(input())):
		number = int(input())
		pow_two = 1
		while pow_two <= number:
			pow_two *= 2
			print(pow_two)
		sum_formula = number * (number + 1) // 2
		trick_sum = sum_formula - 2 * pow_two + 2
		print(trick_sum)
	return

def three_indices():
	for _ in range(int(input())):
		n = int(input())
		permutation = list(map(int, input().split()))
		(idx_i, idx_j, idx_k) = (1, 2, 3)
		(num_i, num_j, num_k) = (0, 0, 0)
		for idx in range(1, n - 1):
			if permutation[idx] > permutation[idx - 1] and permutation[idx] > permutation[idx + 1]:
				print('YES')
				print(idx, idx + 1, idx + 2)
				break
		else:
			print('NO')
	return

def three_friends():
	for test_cases in range(int(input())):
		coords = list(map(int, input().split()))
		coords_neu = sorted(coords)
		if coords_neu[2] - coords_neu[0] <= 2:
			print(0)
		else:
			print(2 * (coords_neu[2] - coords_neu[0]) - 4)
	return

def decoding():
	length = int(input())
	word = list(input())
	new_word = ''
	for i in range(1, length + 1, 1):
		if len(word) % 2 != 0:
			new_word = new_word + word[0]
		else:
			new_word = word[0] + new_word
		word.pop(0)
	print(new_word)
	return

def cookies():
	number_of_bags = int(input())
	bag_content = list(map(int, input().split()))
	sum_cookies = sum(bag_content)
	cnt_even = 0
	cnt_uneven = 0
	for bag in bag_content:
		if bag % 2 == 0:
			cnt_even += 1
		else:
			cnt_uneven += 1
	if sum_cookies % 2 == 0:
		if cnt_even > 0:
			print(cnt_even)
		else:
			print(0)
	elif cnt_uneven > 0:
		print(cnt_uneven)
	else:
		print(0)
	return

def holidays():
	days = int(input())
	a = days // 7 * 2
	if days % 7 == 6:
		a += 1
	b = (days - 2) // 7 * 2 + 2
	if (days - 2) % 7 == 6:
		b += 1
	print(a, b)
	return
holidays()


from math import ceil
X = int(input())
print(2 * (X // 7) if (X + 1) % 7 != 0 else 2 * (X // 7) + 1, end=' ')
print(2 * (X // 7) + X % 7 if X % 7 in [1, 2, 0] else 2 * (X // 7) + 2)


a = int(input())
ans = a // 7 * 2
ans1 = a // 7 * 2 + min(2, a % 7)
if a % 7 == 6:
	ans += 1
print(ans, ans1)


n = int(input())
(q, r) = (n // 7, n % 7)
mi = q * 2 + (r - 5 if r == 6 or r == 7 else 0)
ma = q * 2 + (r if r <= 2 else 2)
print(mi, ma)


n = int(input())
(d, r) = divmod(n, 7)
print(d * 2 + max(0, r - 5), d * 2 + min(r, 2), sep=' ')


n = int(input())

def min1(n):
	if n % 7 <= 5:
		return 2 * (n // 7)
	else:
		return 2 * (n // 7) + 1

def max1(n):
	if n % 7 == 1:
		return 2 * (n // 7) + 1
	elif n % 7 == 0:
		return 2 * (n // 7)
	else:
		return 2 * (n // 7) + 2
print(min1(n), max1(n))


n = int(input())
if n % 7 == 0:
	out1 = 2 * (n // 7)
	out2 = 2 * (n // 7)
elif n % 7 == 6:
	out1 = 2 * (n // 7) + 1
	out2 = 2 * (n // 7) + 2
else:
	out1 = 2 * (n // 7)
	out2 = 2 * (n // 7) + min(n % 7, 2)
print(out1, out2, sep=' ')


n = int(input())
x = n // 7
y = n % 7
if 2 <= y <= 5:
	print(x * 2, x * 2 + 2)
elif y == 6:
	print(x * 2 + 1, x * 2 + 2)
else:
	print(x * 2, x * 2 + y)


from math import *
n = int(input())
if n % 7 == 0:
	m = n / 7
	x = y = m * 2
elif n < 2:
	x = 0
	y = n
elif n < 7:
	x = 0
	y = 2
else:
	x = floor(n / 7) * 2
	if n % 7 < 2:
		a = 1
	else:
		a = 2
	y = x + a
if n % 7 == 6:
	x = x + 1
print('%d %d' % (x, y))


n = int(input())
d = n // 7 * 2
print(d if n % 7 < 6 else d + 1, d + min(n % 7, 2))


from __future__ import print_function

def min_max_days(n):
	maxi = 2 * (n // 7)
	mini = 2 * (n // 7)
	if n % 7 == 1:
		maxi += 1
	elif n % 7 >= 2:
		maxi += 2
	if n % 7 == 6:
		mini += 1
	return (mini, maxi)
n = int(input())
print(' '.join([str(x) for x in min_max_days(n)]))


n = int(input())
print(n // 7 * 2 + n % 7 - min(n % 7, 5), end=' ')
print(n // 7 * 2 + min(n % 7, 2))


n = int(input())
c = 0
c += int(n / 7) * 2
n -= int(n / 7) * 7
if n == 0:
	print(c, c)
elif n == 1:
	print(c, c + 1)
elif n >= 2 and n <= 5:
	print(c, c + 2)
elif n == 6:
	print(c + 1, c + 2)


x = int(input())
m = x // 7 * 2
if x % 7 == 6:
	m = m + 1
n = x // 7 * 2
a = x % 7
if a == 1:
	n = n + 1
elif 1 < a < 7:
	n = n + 2
print(m, n)


n = int(input())
maximum = 0
minimum = 0
for i in range(1, n + 1):
	if i % 7 == 0 or i % 7 == 6:
		minimum += 1
	if (i - 1) % 7 == 0 or (i - 2) % 7 == 0:
		maximum += 1
print(minimum, maximum)


def __starting_point():
	n = int(input())
	print(n // 7 * 2 + (1 if n % 7 > 5 else 0), n // 7 * 2 + (2 if n % 7 >= 2 else n % 7))
__starting_point()


n = int(input())
m = 2 * int(n / 7)
s = n % 7
if s <= 2:
	ma = s
	mi = 0
if 3 <= s <= 5:
	ma = 2
	mi = 0
if s >= 6:
	ma = 2
	mi = 7 - s
maxs = m + ma
mins = m + mi
li = [str(mins), str(maxs)]
print(' '.join(li))


n = int(input())
x = n // 7
y = n % 7
ans = x * 2
if y >= 6:
	ans += 1
print(ans, end=' ')
if y >= 2:
	if y <= 5:
		ans += 2
	else:
		ans += 1
else:
	ans += y
print(ans)


n = int(input())
if n % 7 == 0:
	x = n // 7 * 2
	print(str(x) + ' ' + str(x))
else:
	x = n // 7 * 2
	d = n % 7
	if d == 6:
		xmin = x + 1
		xmax = x + 2
	elif d == 1:
		xmin = x
		xmax = x + 1
	else:
		xmin = x
		xmax = x + 2
	print(str(xmin) + ' ' + str(xmax))


def p1():
	n = int(input())
	for i in range(0, n, 1234567):
		for j in range(0, n - i, 123456):
			if (n - i - j) % 1234 == 0:
				return 'YES'
	return 'NO'

def p2():
	(n, m) = [int(i) for i in input().split()]
	l = [int(i) for i in input().split()]
	for i in range(n):
		if m - i - 1 < 0:
			return l[m - 1]
		m = m - i - 1

def p3():
	n = int(input())
	b = n // 7 * 2 + min(2, n % 7)
	a = n // 7 * 2
	if n == n // 7 * 7 + 6:
		a = a + 1
	print(a, b)
p3()


def main():
	n = int(input())
	min = n // 7 + (n + 1) // 7
	max = (n + 5) // 7 + (n + 6) // 7
	print(min, max)
main()


n = int(input())
day1 = 0
day2 = 5
(m1, m2) = (0, 0)
for _ in range(n):
	if day1 >= 5:
		m1 += 1
	if day2 >= 5:
		m2 += 1
	day1 = (day1 + 1) % 7
	day2 = (day2 + 1) % 7
print(m1, m2)


N = int(input())
off = N // 7
off *= 2
r = N % 7
if r == 6:
	min_off = off + 1
	max_off = off + 2
elif r >= 2 and r <= 5:
	min_off = off
	max_off = off + 2
elif r == 1:
	min_off = off
	max_off = off + 1
elif r == 0:
	min_off = off
	max_off = off
print('{0} {1}'.format(min_off, max_off))


class CodeforcesTask670ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0

	def read_input(self):
		self.n = int(input())

	def process_task(self):
		r = self.n % 7
		off = self.n // 7 * 2
		d = 0
		if r == 6:
			d = 1
		self.result = '{0} {1}'.format(off + d, off + min(2, r))

	def get_result(self):
		return self.result
Solution = CodeforcesTask670ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
(cnt1, cnt2) = (0, 0)
for i in range(1, n + 1):
	if i % 7 in [0, 6]:
		cnt1 += 1
for i in range(6, n + 6):
	if i % 7 in [0, 6]:
		cnt2 += 1
print(cnt1, cnt2)


n = int(input())
nd = 0
md = n // 7 * 2
u = n % 7
if u == 0:
	nd = n // 7 * 2
elif u == 1:
	nd = n // 7 * 2 + 1
elif u == 6:
	md += 1
	nd = n // 7 * 2 + 2
else:
	nd = n // 7 * 2 + 2
print(md, nd)


import math
days = int(input())
ans = days % 7
if ans == 0:
	print(int(2 * (days // 7)), int(2 * (days // 7)))
elif ans == 1:
	print(int(2 * (days // 7)), int(2 * (days // 7) + 1))
elif ans == 6:
	print(int(2 * (days // 7) + 1), int(2 * (days // 7) + 2))
else:
	print(int(2 * (days // 7)), int(2 * (days // 7) + 2))


from sys import stdin as Si
from math import floor as F
from collections import defaultdict as dt
from operator import itemgetter as ig
from math import pi
N = int(Si.readline())
M = N % 7
(Min, Max) = (0, 0)
(ne, xe) = (0, 0)
if M >= 5:
	ne = M - 5
else:
	ne = 0
if M > 2:
	xe = 2
else:
	xe = M
print(N // 7 * 2 + ne, ' ', N // 7 * 2 + xe)


n = int(input())
Min = 2 * (n // 7) + int(n % 7 == 6)
Max = 2 * (n // 7) + min(2, n % 7)
print(str(Min) + ' ' + str(Max))


n = int(input())
if (n + 1) % 7 == 0:
	print(2 * (n // 7) + 1, 2 * (n // 7) + 2)
elif n % 7 == 0:
	print(2 * (n // 7), 2 * (n // 7))
elif n % 7 == 1:
	print(2 * (n // 7), 2 * (n // 7) + 1)
else:
	print(2 * (n // 7), 2 * (n // 7) + 2)


def main():
	n = int(input())
	print(n // 7 + (n + 1) // 7, (n + 5) // 7 + (n + 6) // 7)
main()


n = int(input())
if n % 7 == 6:
	mini = 2 * ((n + 1) // 7) - 1
	maxa = 2 * ((n + 1) // 7)
	print(str(mini) + ' ' + str(maxa))
elif n % 7 == 1:
	maxa = 2 * ((n - 1) // 7) + 1
	mini = 2 * ((n - 1) // 7)
	print(str(mini) + ' ' + str(maxa))
elif n % 7 == 0:
	maxa = 2 * (n // 7)
	mini = 2 * (n // 7)
	print(str(mini) + ' ' + str(maxa))
elif 2 <= n % 7 <= 5:
	maxa = 2 * ((n - n % 7) // 7) + 2
	mini = 2 * ((n - n % 7) // 7)
	print(str(mini) + ' ' + str(maxa))


n = int(input())
if n <= 2:
	print(0, end=' ')
	print(n)
else:
	p = 0
	tw = n // 7
	rw = n % 7
	if rw <= 2:
		r = rw
	else:
		r = 2
	if rw == 6:
		p = 1
	elif rw == 7:
		p = 2
	print(tw * 2 + p, end=' ')
	print(tw * 2 + r)


n = int(input())
(div, mod) = divmod(n, 7)
base = div * 2
minimum = base + (7 - mod if 5 < mod < 8 else 0)
maximum = base + (2 if mod > 1 else mod)
print(minimum, maximum)


n = int(input())
a = n // 7 * 2
b = n % 7
print(a + (b > 5), a + (b > 0) + (b > 1))


n = int(input())
q = n // 7
r = n % 7
mi = q * 2
if r // 5 > 0:
	mi += r % 5
ma = q * 2 + min(2, r)
print(mi, ma)


n = int(input())
d = n // 7
r = n % 7
(u, v) = (d + d, d + d)
if r == 6:
	u += 1
if r == 1:
	v += 1
if r > 1:
	v += 2
print(u, v)


n = int(input())
mn = n // 7 * 2 + int(n % 7 > 5)
mx = n // 7 * 2 + int(n % 7 > 0) + int(n % 7 > 1)
print(mn, mx)


inp = input().split()
n = int(inp[0])
if n % 7 <= 5:
	a = 2 * int(n / 7)
elif n % 7 == 6:
	a = 2 * int(n / 7) + 1
print(a)
if n % 7 >= 2:
	a = 2 * int(n / 7) + 2
elif n % 7 == 1:
	a = 2 * int(n / 7) + 1
else:
	a = 2 * int(n / 7)
print(a)


def solve(n):
	if n == 1:
		return (0, 1)
	if n <= 5:
		return (0, 2)
	if n < 7:
		return (1, 2)
	if n == 7:
		return (2, 2)
	rem = n % 7
	if not rem:
		return (n // 7 * 2, n // 7 * 2)
	else:
		b = n // 7 * 2
		if rem == 1:
			return (b, b + 1)
		if rem <= 5:
			return (b, b + 2)
		if rem < 7:
			return (b + 1, b + 2)

def main():
	n = int(input())
	print(*solve(n))
main()


n = int(input())
print(n // 7 + (n + 1) // 7, (n + 5) // 7 + (n + 6) // 7)


n = int(input())
mm = 0
mx = 0
mmn = n
mxn = n
while mmn >= 0:
	mmn -= 5
	if mmn >= 2:
		mmn -= 2
		mm += 2
	elif mmn == 1:
		mmn -= 1
		mm += 1
while mxn >= 0:
	if mxn >= 2:
		mxn -= 2
		mx += 2
	elif mxn == 1:
		mxn -= 1
		mx += 1
	mxn -= 5
print(mm, mx)


(weeks, days) = divmod(int(input()), 7)
print(2 * weeks + (days == 6), 2 * weeks + min(days, 2))


n = int(input())
if n % 7 >= 2 and n % 7 <= 5:
	h = int((n // 7 + 1) * 2)
	m = int(n // 7 * 2)
if n % 7 == 6:
	h = int((n // 7 + 1) * 2)
	m = int(n // 7 * 2 + 1)
if n % 7 == 1:
	h = int(n // 7 * 2 + 1)
	m = int(n // 7 * 2)
if n % 7 == 0:
	h = int(n // 7 * 2)
	m = h
print(m, h)


n = int(input())
res1 = n // 7 + (n + 1) // 7
res2 = (n + 6) // 7 + (n + 5) // 7
print(res1, res2)


days = int(input())
print(days // 7 * 2 + max(days % 7 - 5, 0), days // 7 * 2 + min(days % 7, 2))


import math
inp = int(input())
if inp == 1:
	print('0 1')
elif inp % 7 == 0:
	both = inp // 7 * 2
	print(both, both)
elif inp % 7 == 6:
	maxim = math.ceil(inp / 7) * 2
	minim = math.ceil(inp / 7) * 2 - 1
	print(minim, maxim)
elif inp % 7 == 1:
	maxim = int(inp / 7) * 2 + 1
	minim = int(inp / 7) * 2
	print(minim, maxim)
elif inp % 7 == 2 or inp % 7 == 3 or inp % 7 == 4 or (inp % 7 == 5):
	maxim = math.ceil(inp / 7) * 2
	minim = maxim - 2
	print(minim, maxim)


n = int(input())
(div, mod) = divmod(n, 7)
_min = 2 * div + max(0, mod - 5)
_max = 2 * div + min(2, mod)
print(_min, _max)


n = int(input())
ans_max = 2 + 2 * ((n - 2) // 7)
if (n - 2) % 7 == 6:
	ans_max += 1
ans_min = 2 * (n // 7)
if n % 7 == 6:
	ans_min += 1
print(ans_min, ans_max)


def main():
	n = int(input())
	min_holidays = n // 7 * 2
	min_holidays += max(0, n % 7 - 5)
	if n <= 2:
		max_holidays = n
	else:
		max_holidays = 2
		rest_days = n - 2
		max_holidays += rest_days // 7 * 2
		max_holidays += max(0, rest_days % 7 - 5)
	print(min_holidays, max_holidays)
main()


n = int(input())
p = n // 7
m = n % 7
if m >= 2:
	print(n // 7 * 2 + m // 6, n // 7 * 2 + 2)
else:
	print(n // 7 * 2, n // 7 * 2 + m)


n = int(input())

def weekends(n):
	return 0 if n == 0 else 2 * (n // 7) + max(n % 7 - 5, 0)
print(weekends(n), 1 if n == 1 else 2 + weekends(n - 2))


(x, y) = divmod(int(input()), 7)
print(x * 2 + (y == 6), x * 2 + min(y, 2))


n = int(input())
basic = 2 * (n // 7)
maxwknds = int(basic)
if n % 7 >= 2:
	maxwknds += 2
elif n % 7 > 0:
	maxwknds += 1
if n % 7 == 6:
	basic += 1
print(basic, maxwknds)


import math
n = int(input())
a = n // 7
b = n // 7
c = n % 7
d = n % 7
if c == 1:
	b = b * 2 + 1
elif c == 0:
	b = b * 2
else:
	b = b * 2 + 2
if d < 6:
	a = a * 2
elif d == 6:
	a = a * 2 + 1
else:
	a = a * 2
print(a, b, sep=' ')


import sys
import math
import itertools as it
import operator as op
import fractions as fr
n = int(sys.stdin.readline().strip())
n_mod_7 = n % 7
min_n = max_n = n // 7 * 2
min_n += n_mod_7 >= 6
max_n += n_mod_7 >= 1
max_n += n_mod_7 >= 2
print(min_n, max_n)


days = int(input())
if days % 7 == 0:
	print(days // 7 * 2, days // 7 * 2)
elif days < 7:
	if days == 6:
		print(1, 2)
	elif days == 1:
		print(0, 1)
	elif days >= 2:
		print(0, 2)
elif days % 7 == 1:
	print(days // 7 * 2, days // 7 * 2 + 1)
elif days % 7 == 6:
	print(days // 7 * 2 + 1, days // 7 * 2 + 2)
elif days % 7 >= 2:
	print(days // 7 * 2, days // 7 * 2 + 2)


x = int(input())
mi = 2 * int(x / 7)
ma = 0
j = x % 7
if j == 0:
	ma = mi
elif j == 1:
	ma = mi + 1
elif j == 6:
	mi += 1
	ma = mi + 1
else:
	ma = mi + 2
print(str(int(mi)) + ' ' + str(int(ma)))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	t = n // 7 * 2
	k = n % 7
	return '{} {}'.format(t + max(0, k - 5), t + min(k, 2))
print(main())


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
n = get_int()
mi = mx = 2 * (n // 7)
res = n % 7
if res == 1:
	mx += 1
elif 1 < res < 6:
	mx += 2
elif res == 6:
	mx += 2
	mi += 1
print(mi, mx)


from sys import stdin
n = int(input())
a = b = 0
if n % 7 == 0:
	a = int(n / 7) * 2
	print(a, a)
else:
	if n % 7 == 6:
		a = int(n / 7) * 2 + 1
	else:
		a = int(n / 7) * 2
	if n % 7 == 1:
		b = int(n / 7) * 2 + 1
	else:
		b = int(n / 7) * 2 + 2
	print(a, b)


n = int(input())
r = n // 7
d = n % 7
minn = 0
maxx = 0
if d == 0:
	print(r * 2, r * 2)
elif d == 1:
	minn = 0
	maxx = 1
	print(r * 2 + minn, r * 2 + maxx)
elif d == 6:
	minn = 1
	maxx = 2
	print(r * 2 + minn, r * 2 + maxx)
else:
	minn = 0
	maxx = 2
	print(r * 2 + minn, r * 2 + maxx)


n = int(input())
o = n
(mini, maxi) = (0, 0)
n -= 5
while n >= 0:
	if n > 2:
		mini += 2
	else:
		mini += n
	n -= 7
while o >= 0:
	if o > 2:
		maxi += 2
	else:
		maxi += o
	o -= 7
print(mini, maxi)


n = int(input())
r = n % 7
if r in [0, 1, 2]:
	print('%d %d' % (2 * int(n // 7), 2 * int(n // 7) + r))
elif r in [3, 4, 5]:
	print('%d %d' % (2 * int(n // 7), 2 * int(n // 7) + 2))
else:
	print('%d %d' % (2 * int(n // 7) + 1, 2 * int(n // 7) + 2))


def main():
	n = int(input())
	(minimum, maximum) = solver(n)
	print(minimum, maximum)

def solver(n):
	weeks = n // 7
	daysOff = weeks * 2
	daysLeft = n - weeks * 7
	if daysLeft <= 1:
		maximum = daysOff + daysLeft
	else:
		maximum = daysOff + 2
	if daysLeft >= 6:
		minimum = daysOff + daysLeft - 5
	else:
		minimum = daysOff
	return (minimum, maximum)
main()


n = int(input())
s = 2 * (n // 7)
p = s
if n % 7 > 2:
	s += 2
else:
	s += n % 7
if n % 7 > 5:
	p += 7 - n % 7
print(p, s)


n = int(input())
max = min = int(n / 7) * 2
mod = n % 7
if mod > 5:
	min += mod - 5
	max += 2
elif mod >= 2:
	max += 2
elif mod == 1:
	max += 1
print(min, max)


a = int(input())
b = a // 7
c = a % 7
d = 2 * b
e = d + c
if c > 2 and c < 6:
	e = 2
	print(d, d + e)
elif c == 6:
	d = d + 1
	e = 2
	print(d, d + e - 1)
else:
	print(d, e)


n = int(input())
a = n // 7
b = n % 7
mi = 0
ma = 0
ma = a * 2
mi = a * 2
if b == 6:
	mi = a * 2 + 1
if b == 1:
	ma = a * 2 + 1
if b >= 2:
	ma = a * 2 + 2
print(mi, ma)


n = int(input())
max = max((n - 2) // 7 * 2 + 2, (n - 1) // 7 * 2 + 1, n // 7 * 2)
max = min(max, n)

def f(x):
	return {0: 0, 1: 0, 2: 0, 3: 0, 4: 0, 5: 0, 6: 1}.get(x, 0)
min = n // 7 * 2 + f(n % 7)
print(str(min) + ' ' + str(max))


def mars_holidays(n):
	if n % 7 == 0:
		return (n // 7 * 2, n // 7 * 2)
	else:
		modn = n % 7
		minoff = 1 if modn == 6 else 0
		maxoff = 1 if modn == 1 else 2
		return (n // 7 * 2 + minoff, n // 7 * 2 + maxoff)

def main():
	n = int(input().strip())
	ans = mars_holidays(n)
	print(' '.join((str(e) for e in ans)))
main()


import math
n = int(input())
max = max((n - 2) // 7 * 2 + 2, (n - 1) // 7 * 2 + 1, n // 7 * 2)
max = min(max, n)
min = n // 7 * 2 + math.floor(n % 7 / 6)
print(str(min) + ' ' + str(max))


n = int(input())
if n % 7 == 1:
	max = 1 + 2 * ((n - 1) // 7)
	min = 2 * ((n - 1) // 7)
elif n % 7 == 2:
	max = 2 + 2 * ((n - 2) // 7)
	min = 2 * ((n - 2) // 7)
elif n % 7 == 3:
	max = 2 + 2 * ((n - 3) // 7)
	min = 2 * ((n - 3) // 7)
elif n % 7 == 4:
	max = 2 + 2 * ((n - 4) // 7)
	min = 2 * ((n - 4) // 7)
elif n % 7 == 5:
	max = 2 + 2 * ((n - 5) // 7)
	min = 2 * ((n - 5) // 7)
elif n % 7 == 6:
	max = 2 + 2 * ((n - 6) // 7)
	min = 2 * ((n - 6) // 7) + 1
elif n % 7 == 0:
	max = 2 * (n // 7)
	min = 2 * (n // 7)
print(min, max)


x = int(input())
lu = 0
zo = 0
x0 = x
while x > 0:
	if x == 1:
		lu += 1
		x = 0
	elif x > 1 and x < 7:
		lu += 2
		x = 0
	lu += x // 7 * 2
	x %= 7
while x0 > 0:
	if x0 == 6:
		zo += 1
		x0 = 0
	elif x0 < 6:
		x0 = 0
	zo += x0 // 7 * 2
	x0 %= 7
print(zo, lu)


n = int(input())
base = n // 7 * 2
miss = n % 7
if miss < 3:
	print(str(base) + ' ' + str(base + miss))
elif miss < 6:
	print(str(base) + ' ' + str(base + 2))
else:
	print(str(base + miss - 5) + ' ' + str(base + 2))


x = int(input())
if x / 7 != x // 7:
	weeks = x // 7 + 1
	days = x % 7
else:
	weeks = x // 7
	days = 7
if days == 7:
	min = weeks * 2
else:
	min = (weeks - 1) * 2
max = weeks * 2
print(min + 1 if days == 6 else min, max - 1 if days == 1 else max)


n = int(input())
weeks = n // 7
days = n % 7
min_off = weeks * 2
if days == 6:
	min_off += 1
max_off = min_off + min(2, days)
if days == 6:
	max_off -= 1
print(min_off, max_off)


d = int(input())
resto = d % 7
mi = d // 7 * 2 + (1 if resto == 6 else 0)
ma = d // 7 * 2 + (2 if resto >= 2 else 1 if resto == 1 else 0)
print(mi, ma)


n = int(input())
if n <= 2:
	print(0, n)
else:
	days = n
	maxHoliday = 2
	minHoliday = 0
	days -= 2
	maxHoliday += 2 * int(days / 7)
	if days % 7 == 6:
		maxHoliday += 1
	minHoliday += 2 * int(n / 7)
	if n % 7 == 6:
		minHoliday += 1
	print(minHoliday, maxHoliday)


try:
	n = int(input())
	if n == 1:
		print(0, '', 1)
	else:
		if n % 7 == 0:
			print(n // 7 * 2, n // 7 * 2)
		if n < 7:
			if n % 7 == 6:
				print(n // 7 * 2 + 1, n // 7 * 2 + 2)
			else:
				print(n // 7 * 2, n // 7 * 2 + 2)
		elif n > 7 and n % 7 != 0:
			k = n % 7
			if k == 6:
				print(n // 7 * 2 + 1, n // 7 * 2 + 2)
			elif k >= 2 and k <= 5:
				print(n // 7 * 2, n // 7 * 2 + 2)
			else:
				print(n // 7 * 2, n // 7 * 2 + 1)
except:
	pass


n = int(input())
w = 2 * (n // 7)
if n % 7 == 0:
	print(2 * (n // 7), 2 * (n // 7))
elif n % 7 > 5:
	max1 = w + 2
	min1 = w + (7 - n % 7)
	print(min1, max1)
elif n % 7 > 2 and n % 7 <= 5:
	max1 = w + 2
	min1 = w
	print(min1, max1)
else:
	max1 = w + n % 7
	min1 = w
	print(min1, max1)