import sequtils, strutils
const
  a = 2
  b = -1
  seq1 = [a, a, b, b, a, b, b]
var
  p = 0
  cnt = 0
let n = parseInt readLine stdin
for v in seq1.cycle 10:
  if p == n:
    echo cnt
    break
  p.inc v
  cnt.inc abs v