There are three points marked on the coordinate plane. The goal is to make a simple polyline, without self-intersections and self-touches, such that it passes through all these points. Also, the polyline must consist of only segments parallel to the coordinate axes. You are to find the minimum number of segments this polyline may consist of.

Input

Each of the three lines of the input contains two integers. The i-th line contains integers xi and yi ( - 109 ≤ xi, yi ≤ 109) — the coordinates of the i-th point. It is guaranteed that all points are distinct.

Output

Print a single number — the minimum possible number of segments of the polyline.

Examples

Input

1 -1
1 1
1 2


Output

1


Input

-1 -1
-1 3
4 3


Output

2


Input

1 1
2 3
3 2


Output

3

Note

The variant of the polyline in the first sample: <image> The variant of the polyline in the second sample: <image> The variant of the polyline in the third sample: <image>
#!/usr/bin/python
'''
Codeforces template

Copyright by Jeroen van Wolffelaar <jeroen@wolffelaar.nl>, 2016
Codeforces username 'jeroen'

Pick any license you want: Public domain / WTFPL / MIT / 3-clause BSD / PSFL


Makes it easy to run under various modes, like adhoc something, regular mode,
various verbosity options. Compares output to expected, shows time taken, can
enable the python profiler, can show in/out.

print statement will not end up in actual output, you must use out(), outp(),
or return the result from case().

Usage:

- Run with one argument, the single .in file in the currect directory matching
  the argument will be picked.

- Omit the mask, and the script will pick the most recently modified .in file.

- Run with the first argument being a global in the solution, and that
  function will be called with the remaining arguments passed through.

  If you specify 'case', you can thus run a single case.

'''

import sys, os, subprocess, time, optparse, collections
from pprint import pprint

import __main__

def line():
    L = sys.stdin.readline()
    if not L:
        raise Exception("End of file")
    if VERBOSE:
        print 'INPUT:', L,
    return L.strip()
def ints():
    return map(int, line().split())

def outp(s): # p for partial (= no newline)
    outp.used = True
    OUT.write(s)
def out(s):
    outp(str(s)+'\n')

def vprint(s):
    if VERBOSE: print s

def profile(func, *a, **kw):
    if OPTS.profile:
        import cProfile, pstats
        P = cProfile.Profile()
        P.enable()

    try:
        return func(*a, **kw)
    finally:
        if OPTS.profile:
            print '='*80
            P.disable()
            P.print_stats('cumulative')
            print '='*80

def processInput():
    solution()
    if sys.stdin.readline():
        print >>sys.stderr, 'WARNING: not all input consumed!'

def main():
    parser = optparse.OptionParser()
    parser.add_option('--run', action='store_true')
    parser.add_option('--outfd')
    parser.add_option('-v', '--verbose', action='store_true')
    parser.add_option('-d', '--debug', action='store_true')
    parser.add_option('-q', '--quiet', action='store_true') # suppress stdout
    parser.add_option('-p', '--profile', action='store_true')
    opts, args = parser.parse_args()

    if opts.outfd is not None:
        out = os.fdopen(int(opts.outfd), 'w')
    else:
        out = sys.stdout

    global OUT, OPTS, VERBOSE, DEBUG
    __main__.OUT     = OUT     = out
    __main__.OPTS    = OPTS    = opts
    __main__.VERBOSE = VERBOSE = opts.verbose
    __main__.DEBUG   = DEBUG   = opts.debug

    if opts.run is None:
        if not os.isatty(sys.stdin.fileno()):
            opts.run = True

    if opts.run:
        return profile(processInput)

    if args:
        cmd = args[0]
        if hasattr(__main__, cmd):
            res = getattr(__main__, cmd)(*args[1:])
            pprint(res)
            return

    if args:
        mask, = args
        mastermain(mask)
    else:
        mastermain()

def mastermain(mask=None):
    files = [f for f in os.listdir('.') if f.endswith('.in')]
    if not files:
        raise Exception("No .in file found")

    if mask is None:
        fn = max(files, key=os.path.getmtime)
    else:
        matches = [f for f in files if mask in f]
        if not matches:
            raise Exception("No .in file matched %r" % mask)
        if len(matches) > 1:
            raise Exception("Too many .in file matched %r: [%s]"
                    % (mask, ', '.join(matches)))
        fn, = matches

    print "Processing input from %r..." % fn

    root = fn[:-2]
    infn   = root+'in'
    tmpfn  = root+'tmp'
    outfn  = root+'out'
    goodfn = root+'good'
    assert infn == fn

    with open(infn) as fdin:
        with open(tmpfn, 'wb') as fdout:
            start = time.time()
            kw = {}
            if OPTS.quiet:
                kw.update(stdout=open('/dev/null', 'w'))
            rc = subprocess.call(sys.argv +
                [ '--run', '--outfd=%d' % fdout.fileno()],
                    stdin=fdin, **kw)
            tottime = time.time()-start

    print 'Done in %.3fs' % tottime
    if rc:
        print "WITH EXITCODE %d" % rc
        return

    os.rename(tmpfn, outfn)
    if os.path.exists(goodfn):
        subprocess.call(['diff', '-sdu', goodfn, outfn])
    else:
        print '>>> %s' % outfn
        with open(outfn, 'r') as fd:
            sys.stdout.write(fd.read())
        print '<<< %s' % outfn

    print 'Done in %.3fs' % tottime

# BEGIN SOLUTION

def solution():
    p = []
    for i in range(3):
        p.append(ints())

    def straight(a, b):
        return p[a][0] == p[b][0] or p[a][1] == p[b][1]
    def swap(a, b):
        p[a], p[b] = p[b], p[a]

    if straight(0, 2):
        swap(1, 2)
    elif straight(1, 2):
        swap(0, 2)
    if straight(0, 1) and straight(0, 2):
        swap(0, 1)

    if straight(0, 1):
        if not p[0][0] == p[1][0]:
            for i in range(3):
                p[i] = p[i][1], p[i][0]

    if p[0][0] == p[1][0] == p[2][0]:
        return out(1)
    if straight(0, 1) and straight(1, 2):
        return out(2)
    if straight(0, 1):
        if (p[2][1] > max(p[0][1], p[1][1])
            or
            p[2][1] < min(p[0][1], p[1][1])):

            return out(2)

    out(3)

# END SOLUTION

if __name__ == '__main__':
    main()
