import java.util.*;

public class Solution {
    static boolean isValid(int num) {
        num = Math.abs(num);
        while (num > 0) {
            if (num % 10 == 8)
                return true;
            num /= 10;
        }
        return false;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while (scan.hasNext()) {
            int num = scan.nextInt() + 1;
            int res = 1;
            while (!isValid(num)) {
                num += 1;
                res ++;
            }
            System.out.println(res);
        }
    }
}

import java.lang.*;
import java.io.*;
import java.util.*;

public class Tower {

	public static void main(String[] args) throws java.lang.Exception {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(in, out);
		out.close();
	}
}

class TaskA {

	public void solve(InputReader in, PrintWriter out) {
		int n = in.nextInt();
		int ans = 0;

		do {
			++n;
			++ans;
		} while (judge(n)==false);

		out.println(ans);
	}

	private static boolean judge(int x) {
		x = Math.abs(x);
		while (x > 0) {
			if (x%10 == 8)
				return true;
			x /= 10;
		}
		return false;
	}
}

class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer==null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;
import java.util.StringTokenizer;

public class CodeForcesQues {

	public static void main(String[] args)throws IOException,NumberFormatException {
		try {
			FastScanner sc=new FastScanner();
			int n=sc.nextInt();
			int count=0;
			if(n>=0) {
				for(int i=1;i<=10;i++) {
					++count;
					if(check(n+i)) {
					 	break;
					}
				}
				System.out.println(count);
			}
			else {
				for(int i=1;i<=16;i++) {
					++count;
					if(check(n+i)) {
						break;
					}
				}
				System.out.println(count);
			}
		}
		catch(Exception e) {
			return;
		}

	}
	public static boolean check(int n) {
		while(n!=0) {
			int temp=n%10;
			if(Math.abs(temp)==8) {
				return true;
			}
			n=n/10;
		}
		return false;
	}

	public static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
                                      st=new StringTokenizer(br.readLine());
                              } catch (IOException e) {}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}

	}
}

import java.io.*;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;
import java.lang.Math;
import java.util.ArrayList;
import java.util.*;
import java.math.*;

public class gigatower{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();

		int count = 0;

		while(true){
			count += 1;
			a += 1;

			String s = Integer.toString(a);
			String[] numbers = s.split("");
			if(a >= -8){
				if(a >= 0){
					for(int i = 0;i < numbers.length;i++){
						if(Integer.parseInt(numbers[i]) == 8){
							System.out.println(count);
							System.exit(0);
						}
					}
				}

				else{
					for(int i = 1;i < numbers.length;i++){
					if(Integer.parseInt(numbers[i]) == 8){
						System.out.println(count);
						System.exit(0);
						}
					}
				}
			}

			else if(a < -8){
				for(int i = 1;i < numbers.length;i++){
					if(Integer.parseInt(numbers[i]) == 8){
						System.out.println(count);
						System.exit(0);
					}
				}
			}
		}
	}
}

import java.awt.*;
import java.awt.geom.Area;
import java.io.*;
import java.math.*;
import java.util.*;
import java.util.Map.Entry;

import static java.lang.Math.*;

public class Solution implements Runnable {
        final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
        BufferedReader in;
        PrintWriter out;
        StringTokenizer tok = new StringTokenizer("");
        String delim = " ";

        String readString() throws IOException {
        	try {
	    		while(!tok.hasMoreTokens()) {
	    			tok = new StringTokenizer(in.readLine());
		        }
		        return tok.nextToken(delim);
	    	}
        	catch (Exception e){
        		return null;
	    	}
        }

        int readInt() throws IOException{
            return Integer.parseInt(readString());
        }
        long readLong() throws IOException{
            return Long.parseLong(readString());
        }
        double readDouble() throws IOException{
            return Double.parseDouble(readString());
        }
        Point readPoint() throws IOException {
        	return new Point(readInt(), readInt());
        }

        char readChar() throws IOException{
        	int x = 0;
        	while ((x = in.read()) == '\n' || x == '\r' || x == ' '){ }
        	return (char)x;
        }

//----------------------------------
        public class Pair<T1,T2> {
            public T1 x1;
            public T2 x2;
            public Pair(){}
            public Pair(T1 x1, T2 x2){
                this.x1 = x1;
                this.x2 = x2;
            }
            public String toString(){
                return x1 + ":" + x2;
            }
        }

        public class Three implements Comparable<Three> {
            public int x; int y, z;
            public Three(){}
            public Three(int a, int b, int c){x = a;y=b;z=c;}
            public String toString(){
                return x + ":" + y + ":" + z;
            }
			@Override
			public int compareTo(Three arg0) {
				return x - arg0.x;
			}
        }
//----------------------------------------

        boolean contains8(long a){
        	a = abs(a);
        	while (a > 0){
        		long temp = a%10;
        		if (temp == 8) return true;
        		a /= 10;
        	}

        	return false;
        }

        long nextE(long a){
        	while (!contains8(a)){
        		a++;
        	}
        	return a;
        }

        void solve() throws NumberFormatException, IOException {

        	long a = readLong();

        	long c = nextE(a+1);

        	long res = c - a;
        	out.println(res);
        }

//----------------------------------------
        public static void main(String[] args){
            new Thread(null, new Solution(), "", 256 * (1L << 20)).start();
        }

        public void run(){
                try{
                        timeBegin = System.currentTimeMillis();

                        try{
                            if (ONLINE_JUDGE){
                                in = new BufferedReader(new InputStreamReader(System.in));
                                out = new PrintWriter(System.out);
                            }
                            else {
                            	in = new BufferedReader(new FileReader("input.txt"));
                            	out = new PrintWriter("output.txt");
                            }
                        }catch(Throwable e){
                            in = new BufferedReader(new InputStreamReader(System.in));
                            out = new PrintWriter(System.out);
                        }

                        solve();
                        out.close();

                        timeEnd = System.currentTimeMillis();
                        System.err.println("Time = " + (timeEnd - timeBegin));
                }catch (Exception e){
                        e.printStackTrace(System.err);
                        System.exit(-1);
                }
        }

        long timeBegin, timeEnd;
}

import java.util.*;

public class Main
{
    static boolean Isluck(int a)
    {
        if(a<0)
            a = -a;
        while(a != 0)
        {
            if(a%10 == 8)
                return true;
            a /=10;
        }
        return false;
    }
    public static void main (String[] args)
    {
        Scanner cin = new Scanner(System.in);
        while(cin.hasNext())
        {
            int n = cin.nextInt();
            int m = n + 1;
            while(Isluck(m) == false)
            {
                m++;
            }
            System.out.println((m-n));
        }
    }
}

import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;

public class A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long i=1;
		String s="8888888888";
		while(true) {
			String s1=Long.toString(n+i);
//			System.out.println(s1);
			if(s1.indexOf('8')!=-1) {
				break;
			}
			i++;

		}

	System.out.println(i);
	}
}

import java.util.*;
public class maximus {
 public static void main(String [] args){
 Scanner in=new Scanner(System.in);
 long a=in.nextLong();
 boolean flag=true;
 int ans=0;
 //System.out.println((-567)%10);
 for(long i=a+1;flag;i++){
 	ans++;
 	long temp=i;
 	while(temp !=0){
 	//System.out.println(temp%10+" ");
 	if(temp%10==8||temp%10==-8)flag=false;
 	temp/=10;
 	}
 }
 System.out.print(ans);
 }
}

import java.util.Scanner;

public class a {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		long value = input.nextLong();
		int ans = 0;
		for(int i = 1; i <= 100 ; i++){
			ans = i;

			value++;
			String a = value + "";
			if((a).toString().contains("8"))
				break;
		}

		System.out.println(ans);

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A488 {

    /**
     * @param args
     * @throws IOException
     */
    public static void main(String[] args) throws IOException {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        long a = Long.parseLong(bf.readLine());
        boolean result = false;
        int s = 0;
        while(!result){
            a++;
            s++;
            char[] d = String.valueOf(a).toCharArray();
            for (char c : d) {
                if(c == '8'){
                    result = true;
                }
            }
        }
        System.out.println(s);

    }

}

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
        Scanner sc =new Scanner(System.in);
        int a = sc.nextInt();
        int c = 0;

        int d = a+1;
        while(true){

            String s = Integer.toString(d);
            //System.out.println(s);
            c++;
            if(s.contains("8")){
              break;
            }

            d++;
        }
        System.out.println(c);
	}
}

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = in.nextInt();
        int b = 0;
        int temp = 0;
        int finish = 0;

        while (finish == 0) {
            b++;
            temp = n + b;
            while (temp != 0) {
                if (temp % 10 == 8 || temp % 10 == -8 )
                    finish = 1;
                temp /= 10;
            }
        }

        out.println(b);
        out.close();
    }
}

//package C_24_10_2014;

import java.util.Scanner;

public class A_488 {
  public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	String s = "";
	int ans = 0;
	for(int i = n+1; ; i++){
		ans++;
		 s = ""+i;
		 for(int j = 1; j <= s.length(); j++){
			 if(s.charAt(j-1)=='8'){
				 System.out.println(ans);
				 return;
			 }
		 }
	}
}
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args) {
		Reader reader = new Reader(System.in);
		PrintWriter writer = new PrintWriter(new BufferedOutputStream(
				System.out));

		int floor = reader.readInt();
		int b = 0;

		if (floor >= 0) {
			int temp;
			b=1;
			while (true) {
				temp = floor + b;
				boolean found = false;
				while (temp != 0) {
					if (temp % 10 == 8) {
						found = true;
						break;
					}
					temp /= 10;
				}
				if (found)
					break;

				b++;
			}
		} else {
			b=1;
			if(floor>-9)
				b= Math.abs(floor)+8;
			else{
			floor *=-1;
			while (true) {
				int temp = floor - b;
				boolean found = false;
				while (temp != 0) {
					if (temp % 10 == 8) {
						found = true;
						break;
					}
					temp /= 10;
				}
				if (found)
					break;

				b++;
			}
			}
		}
		writer.println(b);
		writer.close();
	}

	public static class Reader {
		BufferedReader br;
		StringTokenizer st;

		public Reader(InputStream in) {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		private String read() {
			if (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

			return st.nextToken();
		}

		public String readWord() {
			return read();
		}

		public long readLong() {
			return Long.parseLong(read());
		}

		public int readInt() {
			return Integer.parseInt(read());
		}

		public double readDouble() {
			return Double.parseDouble(read());
		}

		public float readFloat() {
			return Float.parseFloat(read());
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Scanner sc = new Scanner(br);
        Long l = sc.nextLong();
        for (int i = 1; i <= 100; i++) {
            if (isLucky(l + i)) {
                System.out.println(i);
                break;
            }
        }
    }

    public static boolean isLucky(Long l) {
        if (l.toString().contains("8"))
            return true;
        else
            return false;
    }
}

public class tower{
    public static void main(String[] args) throws java.io.IOException{
        java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
		java.io.PrintWriter out = new java.io.PrintWriter(System.out, true);

		long a = Long.parseLong(br.readLine());

		long b = 0;

		if(checkForEight(a)){
		    b++;
		    a += 1;
		}

		while(!checkForEight(a)){
		    b++;
		    a += 1;
		}

	    out.println(b);
		out.close();
    }

    public static boolean checkForEight(long a){
        boolean status = false;

        if(a<0)
          a = -a;

        while(a > 0){
            long r = a % 10;
            if(r==8){
                status = true;
                break;
            }

            a /=10;

        }

        return status;
    }
}

import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.InputStream;
import java.util.NoSuchElementException;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        Task278A solver = new Task278A();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task278A {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long x=in.readLong();
        for (int i=1; ; i++) if (f(++x)) {
            out.printLine(i);
            return;
        }
    }

    boolean f(long x) {
        x=Math.abs(x);
        for (; x>0; x/=10) if (x%10==8) return true;
        return false;
    }
}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {
    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void close() {
        writer.close();
    }

    public void printLine(int i) {
        writer.println(i);
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
import javax.swing.text.html.HTMLDocument.HTMLReader.CharacterAction;

@SuppressWarnings("unused")
public class TaskA {

    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    PrintWriter out = new PrintWriter(System.out);;
    StringTokenizer st = new StringTokenizer("");

    public static void main(String[] args) throws Exception {
        new TaskA().run();
    }

    private void run() throws Exception {

        // Here To Code

        int a = readInt();
        for (int i=1; i<21; i++) {
            if (String.valueOf(a+i).contains("8")) {
                print(i);
                return;
            }
        }
        print("Error");

    }

    private void print(double d) {
        out.print(d);
        out.flush();
    }

    private void print(String string) {
        out.print(string);
        out.flush();
    }

    private void print(boolean b) {
        out.print(b);
        out.flush();
    }

    private void print(int i) {
        out.print(i);
        out.flush();
    }

    private void print(long l) {
        out.print(l);
        out.flush();
    }

    private String readString() throws Exception {
        while(!st.hasMoreTokens())
            st = new StringTokenizer(stdin.readLine());
        return st.nextToken();
    }

    private String readStringChar() throws Exception {
        while(!st.hasMoreTokens())
            st = new StringTokenizer(stdin.readLine());
        return st.nextToken();
    }

    private int readInt() throws Exception {
        return Integer.parseInt(readString());
    }

    private double readDouble() throws Exception {
        return Double.parseDouble(readString());
    }

    private long readLong() throws Exception {
        return Long.parseLong(readString());
    }

    private void close() {
        out.close();
    }

    private void readIntArrays(boolean tandem, int[]... arrays) throws Exception {
        if (tandem) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++)
                    arrays[j][i] = readInt();
            }
            return;
        }
        for (int[] i : arrays) {
            for (int j=0; j<i.length; j++) i[j] = readInt();
        }
    }

    private void readLongArrays(boolean tandem, long[]... arrays) throws Exception {
        if (tandem) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++)
                    arrays[j][i] = readInt();
            }
            return;
        }
        for (long[] i : arrays) {
            for (int j=0; j<i.length; j++) i[j] = readLong();
        }
    }

    private void readLongArrays(boolean tandem, Long[]... arrays) throws Exception {
        if (tandem) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++)
                    arrays[j][i] = readLong();
            }
            return;
        }
        for (Long[] i : arrays) {
            for (int j=0; j<i.length; j++) i[j] = readLong();
        }
    }

    private void readStringArrays(boolean tandem, String[]... arrays) throws Exception {
        if (tandem) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++)
                    arrays[j][i] = readString();
            }
            return;
        }
        for (String[] i : arrays) {
            for (int j=0; j<i.length; j++) i[j] = readString();
        }
    }

    private void readDoubleArrays(boolean tandem, double[]... arrays) throws Exception {
        if (tandem) {
            for (int i = 0; i < arrays[0].length; i++) {
                for (int j = 0; j < arrays.length; j++)
                    arrays[j][i] = readDouble();
            }
            return;
        }
        for (double[] i : arrays) {
            for (int j=0; j<i.length; j++) i[j] = readDouble();
        }
    }

    @SuppressWarnings("unchecked")
    private void readIntList(boolean tandem, List<Integer>... lists) throws Exception {
        if (tandem) {
            for (int i = 0; i < lists[0].size(); i++) {
                for (int j = 0; j < lists.length; j++)
                    lists[j].add(readInt());
            }
            return;
        }
        for (List<Integer> i : lists) {
            for (int j=0; j<i.size(); j++) i.add(readInt());
        }
    }

    @SuppressWarnings("unchecked")
    private void readStringList(List<String>... lists) throws Exception {
        for (List<String> i : lists) {
            for (int j=0; j<i.size(); j++) i.add(readString());
        }
    }

    @SuppressWarnings("unchecked")
    private void readLongList(List<Long>... lists) throws Exception {
        for (List<Long> i : lists) {
            for (int j=0; j<i.size(); j++) i.add(readLong());
        }
    }

    @SuppressWarnings("unchecked")
    private void readDoubleList(List<Double>... lists) throws Exception {
        for (List<Double> i : lists) {
            for (int j=0; j<i.size(); j++) i.add(readDouble());
        }
    }

}

import java.util.Scanner;

public class Main {

	public static void main(String[] args)
	{
		Scanner s =new Scanner(System.in);
		long n=s.nextInt();
		int contador=1;
		for (long i = (n+1); i < n+1000; i++)
		{
			String aux=i+"";
			if (aux.contains("8"))
			{
				break;
			}
			contador++;
		}
		System.out.println(contador);

	}

}

import java.util.Scanner;

public class GigaTower2 {
	public static void main(String[] args) {
		Scanner sc= new Scanner(System.in);
		long x= sc.nextLong();
		for(int i=1; i<=16; i++){
			String s= (x+i)+"";
			int len= s.length();
			boolean flag=false;
			for(int j=0; j<len; j++)
				if(s.charAt(j)=='8'){
					System.out.println(i);
					flag=true;
					break;
				}
			if(flag)
				break;
		}

	}

}

import java.io.*;    //PrintWriter
import java.math.*;  //BigInteger, BigDecimal
import java.util.*;  //StringTokenizer, ArrayList

public class R278_Div2_A //Name:
{
	FastReader in;
	PrintWriter out;

	public static void main(String[] args)  {
		new R278_Div2_A().run();
	}

	void run()
	{
		in = new FastReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	void solve()
	{
		int a = in.nextInt();
		int i = 1;
		for (i = 1; i <= 20; i++)
		{
			String s1 = Integer.toString(a+i);
			for (int j = 0; j < s1.length(); j++)
				if (s1.charAt(j) == '8')
				{
					out.println(i);
					return;
				}
		}

		out.println(i);
	}

	//-----------------------------------------------------
	void runWithFiles() {
		in = new FastReader(new File("input.txt"));
		try {
			out = new PrintWriter(new File("output.txt"));
		}
		catch (FileNotFoundException e) {
			e.printStackTrace();
		}
		solve();
		out.close();
	}

	class FastReader
	{
	    BufferedReader br;
	    StringTokenizer tokenizer;

	    public FastReader(InputStream stream)
	    {
	        br = new BufferedReader(new InputStreamReader(stream));
	        tokenizer = null;
	    }
		public FastReader(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
				tokenizer = null;
			}
			catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

	    private String next() {
	        while (tokenizer == null || !tokenizer.hasMoreTokens())
	            try {
	            	tokenizer = new StringTokenizer(br.readLine());
	            }
	            catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        return tokenizer.nextToken();
	    }
		public String nextLine() {
			try	{
				return br.readLine();
			}
			catch(Exception e) {
				throw(new RuntimeException());
			}
		}

	    int nextInt() {
	        return Integer.parseInt(next());
	    }
	    long nextLong() {
	        return Long.parseLong(next());
	    }
	    double nextDouble() {
	        return Double.parseDouble(next());
	    }
	    BigInteger nextBigInteger() {
	        return new BigInteger(next());
	    }
	    BigDecimal nextBigDecimal() {
	        return new BigDecimal(next());
	    }
	}
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.*;

public class Main implements Runnable {
    private boolean _READ_FROM_FILE = false; //System.getProperty("ONLINE_JUDGE") == null; //System.getSecurityManager() == null; //
    private boolean _WRITE_TO_FILE = false;
    static final String _TASK_ID = "in";
    static final String _IN_FILE = _TASK_ID + ".txt";
    static final String _OUT_FILE = _TASK_ID + ".txt";
    BufferedReader reader;
    StringTokenizer tokenizer;

    private void core() throws Exception {
        long here = nextLong();
        for (long i = 1; i < Integer.MAX_VALUE; i++) {
            if (good(here + i)) {
                System.out.println(i);
                break;
            }
        }
    }

    private boolean good(long l) {
        if (l < 0) {
            l = -l;
        }
        while (l != 0) {
            if (l % 10 == 8)
                return true;
            l /= 10;
        }
        return false;
    }

    void debug(Object...os) {
        System.out.println(Arrays.deepToString(os));
    }
//--------------------- IO stuffs ---------------------
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Main());
        thread.start();
        thread.join();
    }
    public void run() {
        try {
            reader = new BufferedReader(_READ_FROM_FILE ? new FileReader(_IN_FILE) : new InputStreamReader(System.in));
            if (_WRITE_TO_FILE) {
                System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(_OUT_FILE))));;
            }
            tokenizer = new StringTokenizer("");
            core();
            reader.close();
            System.out.flush();
            System.out.close();
            System.exit(0);
        } catch (Exception e) {
            System.out.flush();
            e.printStackTrace();
            System.exit(1);
        }
    }
    int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
    long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
    double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
    String nextToken() throws Exception {
        while (!tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }
    boolean nextIsAvailable() throws Exception {
        while (!tokenizer.hasMoreElements()) {
            String line = reader.readLine();
            if (line == null) return false;
            tokenizer = new StringTokenizer(line);
        }
        return true;
    }
}

import java.util.Scanner;

public class Solution{

    public static boolean isFloorLucky(int floor)
	{
		floor=Math.abs(floor);
		while(floor>0)
		{
			int digit=floor%10;
			if(digit==8)
				return true;
			floor/=10;
		}
		return false;
	}
	public static int minFloors(int a)
	{
		int ans=0;
		for(int i=1;i<=20;i++)
		{
			if(isFloorLucky(a+i))
			{
				ans=i;
				break;
			}
		}
		return ans;
	}
    public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		int a=s.nextInt();
		System.out.println(minFloors(a));
    }
}

import java.util.*;
import java.io.*;
public class Main{
  static char arr[][];
  public static void main(String[] args) throws IOException {
    Scanner s=new Scanner(System.in);
    int n=s.nextInt();
    int m=n;
    n++;
    while(!isLucky(n)){
      n++;
    }
    System.out.println(n-m);
  }
  static boolean isLucky(int a){
    int temp=a;
    if(temp<0)
      temp*=-1;
    while(temp!=0){
      if(temp%10==8){
        return true;
      }
      temp /= 10;
    }
    return false;
  }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Created by Greg on 2015/9/16.
 */
public class Main {
    private static void run() {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        long a = nextInt();
        int i = 1;
        for ( ; i <= 20; i++) {
            a += 1;
            if (contains8(a)) break;
        }

        out.println(i);

        out.close();
    }

    private static boolean contains8(long a) {
        a = (a < 0) ? -a : a;
        long d = 0;
        while (a > 0) {
            d = a % 10;
            if (d == 8) {
                return true;
            }
            a = a / 10;
        }
        return false;
    }

    private static StringTokenizer st;
    private static BufferedReader br;
    private static PrintWriter out;

    private static String next() {
        while (st == null || !st.hasMoreElements()) {
            String s;
            try {
                s = br.readLine();
            } catch (IOException e) {
                return null;
            }
            st = new StringTokenizer(s);
        }
        return st.nextToken();
    }

    private static int nextInt() {
        return Integer.parseInt(next());
    }

    private static long nextLong() {
        return Long.parseLong(next());
    }

    public static void main(String[] args) {
        run();
    }
}

import java.util.*;
public class gigaTower {

	public static void main(String[] args) {
	Scanner scn= new Scanner(System.in);
	long num=scn.nextInt();

	int i=1;
	for(;;i++) {
		long n=num+i;
		boolean ans=check(n);
		if(ans)
			break;
	}
	System.out.println(i);
	}
	public static boolean check(long n) {
		while(n!=0) {
			long r=n%10;
			if(n>0 && r==8)
				return true;
			else if(n<0 && r==-8)
				return true;
			n=n/10;
		}
		return false;
	}
}

import java.util.*;
public class GigaTower {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int b = 1;

        while(!isLucky(++n)){
            b++;
        }
        System.out.println(b);
    }

    public static boolean isLucky(int n){
        String str = Integer.toString(n);
        for(char c: str.toCharArray()){
            if(c == '8'){
                return true;
            }
        }
        return false;
    }
}

import java.io.*;

public class Main {
    private final Reader reader;

    private final Writer writer;

    public static void main(String[] args) throws IOException {
        new Main().solve();

    }
    private void solve() throws IOException {
        int a = reader.nextInt();
        int cnt = 0;
        if (eight(a)) {
            a++;
            cnt++;
        }
        while (!eight(a)) {
            cnt++;
            a++;
        }
        writer.print(cnt + "\n");
        writer.flush();
    }

    private boolean eight(int a) {
        while (a != 0){
            if (Math.abs(a % 10) == 8 ){
                return true;
            }
            a /= 10;
        }
        return false;
    }

    Main(InputStream in, OutputStream out) {
        this.reader = new Reader(in);
        this.writer = new Writer(out);
    }

    public Main() {
        this.reader = new Reader();
        this.writer = new Writer();
    }

}

class Reader {

    private final int BUFFER_SIZE = 65536;

    private final DataInputStream din;

    private final byte[] buffer;

    private int bufferPointer, bytesRead;

    Reader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(InputStream in) {
        din = new DataInputStream(in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public long nextUnsignedLong() throws IOException {
        long ret = 0;
        byte c = read();
        while (c <= 32) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0');
        return ret;
    }

    public int nextUnsignedInt() throws IOException {
        int ret = 0;
        byte c = read();
        while (c <= 32) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0');
        return ret;
    }

    public int nextInt() throws IOException {
        int ret = 0;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) {
            c = read();
        }
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0');
        if (neg) {
            return -ret;
        }
        return ret;
    }

    public String nextString(int MAX) throws IOException {
        int cnt = 0;
        char[] buf = new char[MAX];
        byte c;
        while ((c = read()) < 33) ;
        buf[cnt++] = (char) c;
        while ((c = read()) >= 33) {
            buf[cnt++] = (char) c;
        }
        return new String(buf, 0, cnt);
    }

    public char firstCharOfNextUnSpacedString() throws IOException {
        byte c;
        char res;
        while ((c = read()) < 33) ;
        res = (char) c;
        while ((c = read()) >= 33) ;
        return res;
    }

    private void fillBuffer() throws IOException {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1) {
            buffer[0] = -1;
        }
    }

    private byte read() throws IOException {
        if (bufferPointer == bytesRead) {
            fillBuffer();
        }
        return buffer[bufferPointer++];
    }
}

class Writer {
    private final BufferedWriter out;

    Writer() {
        out = new BufferedWriter(new OutputStreamWriter(System.out), 512);
    }

    public Writer(OutputStream out) {
        this.out = new BufferedWriter(new OutputStreamWriter(out), 512);
    }

    void print(char c) throws IOException {
        out.write(c);
    }

    void print(String str) throws IOException {
        out.write(str);
    }

    void println() throws IOException {
        out.write("\n");
    }

    void flush() throws IOException {
        out.flush();
    }

    @Override
    protected void finalize() throws IOException {
        out.flush();
    }
}

import java.util.Scanner;

/**
 * @author Administrator
 *
 */
public class A {
    static long i,j,k,m,n, a, arr[];
    static String s,str,s_arr[];
    static String res="";
    static boolean checkLucky(String str){
        for (int i=0;i<str.length();i++){
            if (str.charAt(i)=='8')
                return true;
        }
        return false;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        str = in.nextLine();
        n = Long.parseLong(str);
        int ans=0;
        for (;;){
            ans++;
            if (checkLucky((n+ans)+"")){
                System.out.println(ans);
                break;
            }
        }

    }
}

import java.util.Scanner;

public class Giga_Tower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		Long f = scan.nextLong();
		Long ff = f + 1;
		for (;; ff++) {
			if (ff.toString().contains("8")) {
				System.out.print(ff - f);
				break;
			}
		}
		scan.close();
	}
}

import java.util.Scanner;

public class A_Giga_Tower_Round278 {

	// public static void main(String[] args) {
	// Scanner x = new Scanner(System.in);
	// StringBuffer num = new StringBuffer(x.next());
	// long value = 0;
	// boolean flag = false;
	//
	// if (num.charAt(0) != '-') {
	// for (int i = num.length() - 1; i >= 0; i--) {
	// if (num.charAt(i) > '9') {
	// num.setCharAt(i, '0');
	// if (i == 0)
	// num.insert(0, "1");
	// else {
	// num.setCharAt(i - 1, (char) (num.charAt(i - 1) + 1));
	// }
	// } else if (num.charAt(i) == '9') {
	// num.setCharAt(i, '0');
	//
	// if (i == 0)
	// num.insert(0, "1");
	// else {
	// num.setCharAt(i - 1, (char) (num.charAt(i - 1) + 1));
	// if (num.charAt(i - 1) <= '9' && flag)
	// break;
	//
	// }
	//
	// } else if (num.charAt(i) == '8') {
	// if (flag) {
	// num.setCharAt(i, (char) (num.charAt(i) + 1));
	// break;
	// }
	//
	// flag = true;
	// } else {
	// if (flag)
	// num.setCharAt(i, (char) (num.charAt(i) + 1));
	// else
	// num.setCharAt(i, '8');
	// break;
	// }
	//
	// }
	// // if (Long.parseLong(num.toString()) == 0) {
	// // num.setCharAt(num.length() - 1, '8');
	// // num.insert(0, "1");
	// // }
	// } else {
	//
	// }
	// System.out.print(num.toString());
	//
	// }

	static boolean che(long x) {

		int temp;
		while (x != 0) {
			temp = (int) (x % 10);
			//System.out.println(temp);
			if (temp == 8 || temp == -8)
				return true;
			x /= 10;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner x = new Scanner(System.in);
		long num = x.nextInt(), value = num;

		value++;

		while (!che(value)) {
			//System.out.println("Value" + value);
			value++;
		}

		//System.out.println(value + " " + num);
		System.out.print(value - num);

	}

}

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.util.InputMismatchException;
import java.util.Stack;

/**
 * Ashesh Vidyut (Drift King) *
 */
public class A {
    public static void main(String[] args) {
        try {
            InputReader in = new InputReader(System.in);
            BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));
            long n = in.readLong();
            long count = 1;
            n++;
            while(!Long.toString(n).contains("8")){
                count++;
                n++;
            }
            out.write(Long.toString(count));
            out.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
class InputReader {
    private boolean finished = false;

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }

    public int peek() {
        if (numChars == -1)
            return -1;
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                return -1;
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int length = readInt();
        if (length < 0)
            return null;
        byte[] bytes = new byte[length];
        for (int i = 0; i < length; i++)
            bytes[i] = (byte) read();
        try {
            return new String(bytes, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            return new String(bytes);
        }
    }

    public static boolean isSpaceChar(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    private String readLine0() {
        StringBuffer buf = new StringBuffer();
        int c = read();
        while (c != '\n' && c != -1) {
            if (c != '\r')
                buf.appendCodePoint(c);
            c = read();
        }
        return buf.toString();
    }

    public String readLine() {
        String s = readLine0();
        while (s.trim().length() == 0)
            s = readLine0();
        return s;
    }

    public String readLine(boolean ignoreEmptyLines) {
        if (ignoreEmptyLines)
            return readLine();
        else
            return readLine0();
    }

    public BigInteger readBigInteger() {
        try {
            return new BigInteger(readString());
        } catch (NumberFormatException e) {
            throw new InputMismatchException();
        }
    }

    public char readCharacter() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        return (char) c;
    }

    public double readDouble() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        double res = 0;
        while (!isSpaceChar(c) && c != '.') {
            if (c == 'e' || c == 'E')
                return res * Math.pow(10, readInt());
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        }
        if (c == '.') {
            c = read();
            double m = 1;
            while (!isSpaceChar(c)) {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, readInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                m /= 10;
                res += (c - '0') * m;
                c = read();
            }
        }
        return res * sgn;
    }

    public boolean isExhausted() {
        int value;
        while (isSpaceChar(value = peek()) && value != -1)
            read();
        return value == -1;
    }

    public String next() {
        return readString();
    }

    public boolean readBoolean() {
        return readInt() == 1;
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package javaapplication10;

import java.awt.Point;
import java.io.IOException;
import java.util.Scanner;

/**
 *
 * @author Lenovo
 */
public class Solultion {
   public static void main(String[] args){
		new Solultion().solve();
	}
	Scanner s = new Scanner(System.in);
        boolean chk(int n){
            while(n!=0){
                int rem=n%10;
                if(Math.abs(rem)==8)
                    return true;
                n=n/10;
                //System.out.println(rem);
                //System.out.println(n);
            }
            return false;

        }
        void solve(){
            int n=s.nextInt();
            int cnt=0;
            while(chk(n)==false){
                cnt++;
                n++;
            }
            if(cnt==0){
                n++;
                cnt=1;
                while(chk(n)==false){
                    cnt++;
                    n++;
                }
            }

            System.out.println(cnt);

        }

}

import java.util.Scanner;

public class GigaTower {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        n++;
        int res = 1;
        while (true) {
            if ((n + "").contains("8"))
                break;
            n++;
            res++;
        }
        System.out.println(res);
    }
}

import java.util.*;
import java.io.*;
public class GigaTower
{
    public static void main(String []args) throws IOException {
	FastScanner in  = new FastScanner(System.in);
	FastWriter  out = new FastWriter(System.out);
	//solve1(in, out);
	solve2(in,out);
	in.close();
	out.close();
    }
    private static boolean isLucky(long n)
    {
	n = Math.abs(n);
	while(n>0)
	{
	    if(n%10 == 8)
		return true;

	    n /= 10;
	}
	return false;
    }
    private static void solve2(FastScanner s1, FastWriter out)
    {
	long start = s1.nextLong();
	int ct = 1;
	start++;
	while(!isLucky(start++))
	    ct++;

	out.print(ct);
    }
    private static void solve1(FastScanner s1, FastWriter out)/* This is the actual solution */{

	long n = s1.nextLong();
	if(n>=0)
	{

	if(n%10 == 8)
	{
	    long rest = n/10;
	    if(isLucky(rest))
	    {
		out.print("1");
		return;
	    }
	}

	if((n%10) < 8)
	{
	    long rest = n/10;
	    if(isLucky(rest))
		out.print("1");
	    else
		out.print(8-(n%10));
	}
	else
	{
	    long rest = (n/10) + 1;
	    long new_n;
	    if(isLucky(rest))
		new_n = (rest*10);
	    else
		new_n = (rest*10)+8;

	    out.print((new_n-n));
	}
	}
	else
	{
	    n = -n;
	    if(n<=8)
	    {
		out.print(n+8);
	    }
	    else if(n%10 == 9)
		out.print("1");
	    else
	    {
		long rest = n/10;
		if(isLucky(rest) && (n%10 != 0))
		    out.print("1");
		else
		{
		    rest = (n/10) - 1;
		    if(isLucky(rest))
			out.print((n%10)+1);
		    else
		    {
			out.print((n%10)+2);  //(10+MOD)-8
 		    }
		}
	    }
	}

    }

    static class FastScanner{
	public BufferedReader reader;
	public StringTokenizer st;
	public FastScanner(InputStream stream){
	    reader = new BufferedReader(new InputStreamReader(stream));
	    st = null;
	}
	public String next(){
	    while(st == null || !st.hasMoreTokens()){
		try{
		    String line = reader.readLine();
		    if(line == null) return null;
		    st = new StringTokenizer(line);
		}catch (Exception e){
		    throw (new RuntimeException());
		}
	    }
	    return st.nextToken();
	}
	public String nextLine(){
            String str = null;
            try {
                str = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
	public int nextInt(){
	    return Integer.parseInt(next());
	}
	public long nextLong(){
	    return Long.parseLong(next());
	}
	public double nextDouble(){
	    return Double.parseDouble(next());
	}
	int[] nextIntArray(int n) {
	    int[] arr = new int[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextInt();
	    }
	    return arr;
	}

	long[] nextLongArray(int n) {
	    long[] arr = new long[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextLong();
	    }
	    return arr;
	}
	public void close(){
	    try{ reader.close(); } catch(IOException e){e.printStackTrace();}
	}
    }
    static class FastWriter{
	BufferedWriter writer;
	public FastWriter(OutputStream stream){
	    writer = new BufferedWriter(new OutputStreamWriter(stream));
	}
	public void print(int i) {
	    print(Integer.toString(i));
	}
	public void println(int i) {
	    print(Integer.toString(i));
	    print('\n');
	}
	public void print(long i) {
	    print(Long.toString(i));
	}
	public void println(long i) {
	    print(Long.toString(i));
	    print('\n');
	}
	public void print(double i) {
	    print(Double.toString(i));
	}
	public void print(boolean i) {
	    print(Boolean.toString(i));
	}
	public void print(char i) {
	    try{writer.write(i);} catch(IOException e){e.printStackTrace();}
	}
	public void print(String s){
	    try{writer.write(s);} catch(IOException e){e.printStackTrace();}
	}
	public void println(String s){
	    try{writer.write(s);writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void println(){
	    try{writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void print(int arr[])
	{
	    for (int i = 0; i < arr.length; i++) {
		print(arr[i]);
		print(' ');
	    }
	}
	public void close(){
	    try{writer.close();} catch(IOException e){e.printStackTrace();}
	}
    }
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class A_GigaTower {

	public static long findTheMinimumB(long a){

		long b = a;
		long count = 0;
//
//		if(b<0){
//			count += -1*b; //Invert the number
//			b=0;
//		}
//
		do {
			b++;
			count++;
		} while (!Long.toString(b).contains("8"));
		return count;

	}

	public static void main(String[] args) {
//
		try {
//			BufferedReader br = new BufferedReader( new FileReader("TestFile.in"));
			BufferedReader br = new BufferedReader( new InputStreamReader( System.in ));
			String[] arrayN;
			arrayN = (br.readLine().split(" "));
			long a = Long.parseLong(arrayN[0]);
			System.out.println(findTheMinimumB(a));

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}

import java.util.Scanner;
import java.math.BigInteger;

public class Giga_Tower{
    public static void main(String args[]){
            Scanner in = new Scanner(System.in);
            long a = in.nextLong();
            long right = a + 1;
            long count = 0;
            boolean f = true;
            while(f){
                String k2 = String.valueOf(right);
                for(int i = 0 ; i < k2.length() ; i++)
                    if(k2.charAt(i)=='8'){
                        f = false;
                        break;
                    }
                right++;
                count++;
                if(f == false)
                    break;
            }
            System.out.println(count);
    }
}

//package Codeforces.Div2A_278.Code1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/*
 * some cheeky quote
 */

public class Main
{
    FastScanner in;
    PrintWriter out;

    public void solve() throws IOException
    {
        int n = in.nextInt();
        int temp = n + 1;
        while (true)
        {
            String s = Integer.toString(temp);
            if (s.contains("8"))
            {
                System.out.println(temp - n);
                return;
            }
            temp++;
        }
    }

    public void run()
    {
        try
        {
            in = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    class FastScanner
    {
        BufferedReader br;
        StringTokenizer st;

        FastScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreTokens())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }
    }

    public static void main(String[] arg)
    {
        new Main().run();
    }
}

import java.util.*;
import java.io.*;
public class GigaTower
{
    public static void main(String []args) throws IOException {
	FastScanner in  = new FastScanner(System.in);
	FastWriter  out = new FastWriter(System.out);
	solve(in, out);
	in.close();
	out.close();
    }
    private static boolean isLucky(long n)
    {
	while(n>0)
	{
	    if(n%10 == 8)
		return true;

	    n /= 10;
	}
	return false;
    }
    private static void solve(FastScanner s1, FastWriter out)/* This is the actual solution */{

	long n = s1.nextLong();
	if(n>=0)
	{

	if(n%10 == 8)
	{
	    long rest = n/10;
	    if(isLucky(rest))
	    {
		out.print("1");
		return;
	    }
	}

	if((n%10) < 8)
	{
	    long rest = n/10;
	    if(isLucky(rest))
		out.print("1");
	    else
		out.print(8-(n%10));
	}
	else
	{
	    long rest = (n/10) + 1;
	    long new_n;
	    if(isLucky(rest))
		new_n = (rest*10);
	    else
		new_n = (rest*10)+8;

	    out.print((new_n-n));
	}
	}
	else
	{
	    n = -n;
	    if(n<=8)
	    {
		out.print(n+8);
	    }
	    else if(n%10 == 9)
		out.print("1");
	    else
	    {
		long rest = n/10;
		if(isLucky(rest) && (n%10 != 0))
		    out.print("1");
		else
		{
		    rest = (n/10) - 1;
		    if(isLucky(rest))
			out.print((n%10)+1);
		    else
		    {
			out.print((n%10)+2);  //(10+MOD)-8
 		    }
		}
	    }
	}

    }

    static class FastScanner{
	public BufferedReader reader;
	public StringTokenizer st;
	public FastScanner(InputStream stream){
	    reader = new BufferedReader(new InputStreamReader(stream));
	    st = null;
	}
	public String next(){
	    while(st == null || !st.hasMoreTokens()){
		try{
		    String line = reader.readLine();
		    if(line == null) return null;
		    st = new StringTokenizer(line);
		}catch (Exception e){
		    throw (new RuntimeException());
		}
	    }
	    return st.nextToken();
	}
	public String nextLine(){
            String str = null;
            try {
                str = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
	public int nextInt(){
	    return Integer.parseInt(next());
	}
	public long nextLong(){
	    return Long.parseLong(next());
	}
	public double nextDouble(){
	    return Double.parseDouble(next());
	}
	int[] nextIntArray(int n) {
	    int[] arr = new int[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextInt();
	    }
	    return arr;
	}

	long[] nextLongArray(int n) {
	    long[] arr = new long[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextLong();
	    }
	    return arr;
	}
	public void close(){
	    try{ reader.close(); } catch(IOException e){e.printStackTrace();}
	}
    }
    static class FastWriter{
	BufferedWriter writer;
	public FastWriter(OutputStream stream){
	    writer = new BufferedWriter(new OutputStreamWriter(stream));
	}
	public void print(int i) {
	    print(Integer.toString(i));
	}
	public void println(int i) {
	    print(Integer.toString(i));
	    print('\n');
	}
	public void print(long i) {
	    print(Long.toString(i));
	}
	public void println(long i) {
	    print(Long.toString(i));
	    print('\n');
	}
	public void print(double i) {
	    print(Double.toString(i));
	}
	public void print(boolean i) {
	    print(Boolean.toString(i));
	}
	public void print(char i) {
	    try{writer.write(i);} catch(IOException e){e.printStackTrace();}
	}
	public void print(String s){
	    try{writer.write(s);} catch(IOException e){e.printStackTrace();}
	}
	public void println(String s){
	    try{writer.write(s);writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void println(){
	    try{writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void print(int arr[])
	{
	    for (int i = 0; i < arr.length; i++) {
		print(arr[i]);
		print(' ');
	    }
	}
	public void close(){
	    try{writer.close();} catch(IOException e){e.printStackTrace();}
	}
    }
}

import java.util.Scanner;

public class ProblemA {

    public static void main(String[] args) throws Exception{
        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int c = 1;
        for(int i = 1; i <= 16; i++){
            if(has(a + i)){
                System.out.println(c);
                break;
            }else{
                c++;
            }
        }

        in.close();
    }

    public static boolean has(int a){
        a = Math.abs(a);
        while(a > 0){
            int r = a%10;
            a/=10;
            if(r == 8){
                return true;
            }
        }
        return false;
    }

}

import java.util.*;

public class GigaTowerEights {
	public static boolean bad(int n)
	{
		n = Math.abs(n);
		while (n > 0)
		{
			if (n % 10 == 8) return false;
			n /= 10;
		}
		return true;
	}
	public static void main(String[] args)
	{
		Scanner s = new Scanner(System.in);
		int a = s.nextInt();
		int b = 1;
		while (bad(a+b)) b++;

		System.out.println(b);
		s.close();
	}
}

import java.io.IOException;
import java.util.Scanner;

public class cf {

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		for (int i = 1; i < 20; i++) {
			a +=i;
			if ((a + "").contains("8")) {
				System.out.println(i);
				break;
			}

			a -=i;
		}

	}

}

/*
 * import java.io.IOException; import java.util.Scanner;
 *
 * public class cf {
 *
 * public static void main(String[] args) throws IOException { Scanner in = new
 * Scanner(System.in); int t = in.nextInt(); while(t-- != 0){ int res =0; int a
 * = in.nextInt(),b=in.nextInt(); while(a != b ){ if(a > b) a-=b; else b-=a;
 *
 * res++; } System.out.println(res +1); } }
 *
 * }
 *
 */

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int c1 = 0;
		while(true){
			String str = "" + ++n;
			c1++;
			if (str.indexOf('8') != -1) {
				break;
			}
		}
		System.out.println(c1);
	}
}

import java.util.Scanner;

public class ProblemE {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.nextLine();
		Long l = Long.parseLong(s);
		long lUp = l+1;
		String ls = ""+lUp;
		while(!ls.contains("8")){
			lUp++;
			ls = ""+lUp;
		}
		System.out.println(lUp-l);

	}

}

import java.io.*;
import java.util.*;
public class c278 {
	static InputReader in;

	public static void main(String args[]) throws Exception {
		in = new InputReader("input23.txt");
		int n = in.nextInt();
		int count = 0;
		for (int i = 1; i <= 20; i++) {
			int k = n + i;
			String str = k + "";
			if (str.contains("8")) {
				System.out.println(i);
				return ;
			}
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tokenizer;

		public InputReader(String s) {
			try {
				in = new BufferedReader(new FileReader(new File(s)));
				tokenizer = null;
			}
			catch (Exception e) {
				in = new BufferedReader(new InputStreamReader(System.in));
				tokenizer = null;
			}
		}

		public String nextLine() throws Exception {
			return in.readLine();
		}

		public String next() throws Exception {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				tokenizer = new StringTokenizer(in.readLine());
			}
			return tokenizer.nextToken();
		}

		public int nextInt() throws Exception {
			return Integer.parseInt(next());
		}

		public double nextDouble() throws Exception {
			return Double.parseDouble(next());
		}

		public long nextLong() throws Exception {
			return Long.parseLong(next());
		}
	}
}

import java.util.Scanner;

/**
 *
 * @author Tarango Khan
 */
public class CF278_A {
    public static void main(String[] args) {
        Scanner kb = new Scanner(System.in);
        int num = kb.nextInt();
        num++;
        int total = 1;
        int flag = 0;
        while(true){
            /*
            int n = num%10;
            int t = num/10;
            if(t%10 == 8) break;
            if(n<8){
                total += (8-n);
                break;
            }*/
            String s  = Integer.toString(num);
            for(int i = 0;i<s.length();i++){
                if(s.charAt(i) == '8'){
                    flag = 1;
                    break;
                }
            }
            if(flag == 1) break;
            total++;num++;
        }
        System.out.println(total);
    }
}

//package aa;

import java.util.Scanner;

public class map {
    static Scanner in=new Scanner(System.in);
    public static void main(String[] args) {
    int x;
    x=in.nextInt();
    int z=0;
    boolean z1=false;

    for(int i=x+1;true;i++)
    {
    z=i;
    String y="";
    y=y+z;
    //System.out.println(y);
    for(int j=0;j<y.length();j++){
    if(y.charAt(j)=='8'){
        z1=true;
        break;
    }

    }
    if(z1==true){break;}
    }
        System.out.println(z-x);

    }
    }

import java.util.*;
import java.io.*;
import java.math.*;

public class main {
    public static void main(String[] args) throws Exception {
        Reader in = new Reader(System.in);
        Writer out = new Writer(System.out);
        Task task = new Task(in, out);
        task.solve();
        in.close();
        out.close();
    }
}

class Task {
    public void solve() {
        int x = in.nextInt();
        int ans = 0;
        if (check(Math.abs(x))) {
            x++; ans++;
        }
        while (!check(Math.abs(x))) {
            ans++;
            x++;
        }
        out.println(ans);
    }
    boolean check(int x) {
        while (x != 0) {
            if (x % 10 == 8)
                return true;
            x /= 10;
        }
        return false;
    }
    private Reader in;
    private Writer out;
    public Task(Reader input, Writer output) {
        in = input;
        out = output;
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer str;
    Reader(String filename) throws Exception {
        reader = new BufferedReader(new FileReader(filename));
    }
    Reader(InputStream input) throws Exception {
        reader = new BufferedReader(new InputStreamReader(input));
    }
    public String next() {
        while (str == null || str.hasMoreTokens() == false) {
            try {
                str = new StringTokenizer(reader.readLine());
            }
            catch (Exception ex) {
                throw new InputMismatchException();
            }
        }
        return str.nextToken();
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    public void close() throws Exception {
        reader.close();
    }
}

class Writer extends PrintWriter {
    public Writer(OutputStream output) {
        super (output);
    }
    public Writer(String filename) throws Exception {
        super(new File(filename));
    }
    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            this.print(objects[i]);
            this.print(" ");
        }
        this.println();
    }
}

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.lang.Math;

public class A implements Runnable {
    public boolean isLucky (int a) {
	a = Math.abs (a);
	while (a != 0) {
	    int temp = a;
	    a /= 10;
	    if (temp - a * 10 == 8)
		return true;
	}
	return false;
    }
    private void solve () throws IOException {
	int a = nextInt ();
	int ans = 0;
	for (int i = 1; i <= 20; i++) {
	    if (isLucky (a + i)) {
		ans = i;
		break;
	    }
	}
	writer.println (ans);
    }
    public static void main (String[] args) {
	new A ().run ();
    }
    BufferedReader reader;
    PrintWriter writer;
    StringTokenizer tokenizer;
    public void run () {
	try {
	    reader = new BufferedReader (new InputStreamReader (System.in));
	    writer = new PrintWriter (System.out);
	    tokenizer = null;
	    solve ();
	    reader.close ();
	    writer.close ();
	} catch (Exception e) {
	    e.printStackTrace ();
	    System.exit (1);
	}
    }
    int nextInt () throws IOException {
	return Integer.parseInt (nextToken ());
    }
    String nextToken () throws IOException {
	while (tokenizer == null || !tokenizer.hasMoreTokens ()) {
	    tokenizer = new StringTokenizer (reader.readLine ());
	}
	return tokenizer.nextToken ();
    }
}

import java.util.Scanner;
public class NewClass
{
    public static void main(String[] args)
    {
      long current , initial1=0 , initial2=0 , count=0 , temp=0 ;
      //String str="";
      Scanner input = new Scanner(System.in);
      current = input.nextLong();

      while(true)
      {
        current++;
        temp=current;
        initial1=0;
        if(temp < 0)
            temp*=-1;
        while(temp != 0)
          {

              if(temp % 10 == 8)
              {
                  initial1++;
                  break;
              }
              temp -= temp%10;
              temp /= 10;
          }
          count++;

         if(initial1 > 0)
            break;
      }

      System.out.println(count);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        long t = b ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h && r == 9 )
        {
            t /= 10 ;
            while ( t % 10 == 9 && t > 0 )
            {
                t /= 10 ;
            }
            if ( t % 10  == 8 )
                System.out.println(9);
            else
                System.out.println(1);
        }
        else if ( h && t < 0 && r == 0 )
        {
            t /= 10 ;
            t *= -1 ;
            while ( t % 10 == 0 && t > 0 )
            {
                t /= 10 ;
            }
            if ( t % 10  == 8 )
                System.out.println(2);
            else
                System.out.println(1);
        }
        else if ( h )
            System.out.println(1);
        else if ( (t/10)%10 == 7 && r >= 8 )
        {
            System.out.println( 10-r );
        }
        else if ( r > 7 && t > 0 )
            System.out.println(18 - r );
        else if ( t >= 0 )
            System.out.println(Math.abs(r - 8));
        else if ( r == -9 )
            System.out.println( 1 );
        else if ( (t /10)%10 == -9 )
            System.out.println((1-r));
        else if ( r == 0 )
            System.out.println( 2 );
        else if ( t / 10 == 0 )
            System.out.println( 8 - r );
        else
            System.out.println(10-r-8);
    }

}

import java.util.*;
import java.lang.*;
import java.io.*;

public class R278A  {

    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long n = in.nextLong();

        for (int i = 1; i <= 20; i++) {
            if (contains_eight(n + i) ) {
                w.println(i);
                break;
            }
            //System.out.println("n is : " + n);
        }
        //System.out.println("hi");
        w.close();
    }
    static boolean contains_eight(long n) {
        if (n < 0)
            n = n * -1;
        while (n > 0) {
            //System.out.print(n % 10 + " ");
            if (n % 10 == 8)
                return true;
            n /= 10;
        }

        return false;
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class GigaTower {

    public static boolean contains(int x) {

        while (x != 0) {

            if (x % 10 == 8 || x % 10 == -8) {
                return true;
            }
            x /= 10;
        }

        return false;

    }

    public static void main(String[] args) throws IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        int x = Integer.valueOf(reader.readLine());
        Integer integer = Integer.valueOf(x);
        while (true) {
            integer++;
            if (contains(integer)) {
                System.out.println(integer - x);
                break;
            }
        }

    }
}

import java.util.*;
public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		a++;
		int res = 1;
		while(!(a + "").contains("8")) {
			a++;
			res++;
		}
		System.out.println(res);
	}
}

import java.io.*;
import java.util.*;
public final class round_278_a
{
    static FastScanner sc=new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out=new PrintWriter(System.out);

	public static void main(String args[]) throws Exception
	{
		int n=sc.nextInt(),ans=0;
		outer:
		for(int i=1;i<=100;i++)
		{
			char[] c=Integer.toString(n+i).toCharArray();
			for(char ch:c)
			{
				if(ch=='8')
				{
					ans=i;
					break outer;
				}
			}
		}
		out.println(ans);
		out.close();
	}
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
         int n=sc.nextInt(),c=n;
         n++;
         String s=n+"";
         while (!s.contains("8")){
             n++;
             s=n+"";
         }System.out.print(n-c);

    }
}

import java.util.Scanner;

public class a1
{
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		long n=s.nextLong();
		int flag=0;

		for(int i=1;;i++)
		{
			long m=n+i;
			if(n==-1)
			{
				System.out.println(9);
				break;
			}

			while(m!=0)
			{
				int a=(int)m%10;
				m/=10;
				if(a==8 || a==-8)
				{
					System.out.println(i);
					flag=1;
					break;
				}
			}
			if(flag==1)
				break;
		}

	}

}

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		System.out.println(sumar(a));
	}

	static int sumar(int a) {
		for (int i = 1;; i++) {
			if (contiene(a + i)) {
				return i;
			}
		}
	}
	static boolean contiene(int n) {
		return String.valueOf(n).contains("8");
	}
}

import java.util.*;

public class Main {
    public static void main(String[] args) {
        int n, ans=1;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        while(cek(n+ans) == false){
            ans++;
        }
        System.out.println(ans);
    }

    public static boolean cek(int num){
        num = Math.abs(num);
        while(num > 0){
            if(num%10 == 8){
                return true;
            }
            num /= 10;
        }
        return false;
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        StringBuilder s=new StringBuilder();
        long n=Reader.nextLong();
        int i;
        for(i=1;;i++)
            if(check(n+i))
                break;
        s.append(i).append('\n');
        System.out.print(s);
    }

    static boolean check(long n) {
        while(n/10!=0||n%10!=0) {
            if(Math.abs(n%10)==8)
                return true;
            n/=10;
        }
        return false;
    }

}

class Reader {

    static StringTokenizer tokenizer;
    static BufferedReader reader;

    public static void init(InputStream input) throws UnsupportedEncodingException {
        reader=new BufferedReader(new InputStreamReader(input,"UTF-8"));
        tokenizer=new StringTokenizer("");
    }

    public static String next() throws IOException {
        while(!tokenizer.hasMoreTokens())
            tokenizer=new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }

    public static String nextLine() throws IOException {
        return reader.readLine();
    }

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}

import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        int t = 0, x = 0;
        for (int i = 1; true; i++) {
            x = n + i;
            while (x != 0) {
                t = x % 10;
                if (t == 8 || t == -8) {
                    System.out.println(i);
                    return;
                } else {
                    x = x / 10;
                }
            }
        }

    }
}

import java.util.Scanner;

public class CFGiga {

    public static boolean has8(long a) {
        if (a < 0) {
            return has8(-a);
        } else if (a == 0) {
            return false;
        } else {
            long last = (a % 10);
            if (last == 8) {
                return true;
            } else {
                return has8(a / 10);
            }
        }
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long a = input.nextLong();
        for (long i = 1; i <= 20; i++) {
            if (has8(a+i)) {
                System.out.println(i);
                break;
            }
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 108
 287
-100 0
 *
 * */
public class Main
{
    public static void main(String[]arg) throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        long n = Integer.parseInt(in.readLine())+1;
        long np = n;
        int ans = 0;
        String b = ""+n;
        if(b.contains("8"))
        {
            ans = 1;
        }
        else
        {
            while(!b.contains("8"))
            {
                //System.out.println(n);
                ans++;
                b = "" + n;
                n++;
            }
        }
        System.out.println(ans);
    }

}

import java.util.Scanner;
import java.util.Arrays;
public class Gigatower{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int b=0;
		for(int i=1;i<20;i++)
		{
			int check=0;
			int n1=n+i;
			if(n1<0)
				n1=-n1;
			while(n1!=0)
			{
				int x=n1%10;
				if(x==8) {
					check=1;
					break;
				}
				n1/=10;
			}
			if(check==1)
			{
				b=i;
				break;
			}
		}
		System.out.println(b);
	}
}

import java.math.BigInteger;
import java.util.*;

public class CompetitiveProgramming {
    static int[] sieveOfEratosthenes(int n) {
        int[] primes = new int[n + 1];
        for (int i = 0; i < n + 1; i++) {
            primes[i] = 1;
        }
        primes[0] = 0;
        primes[1] = 0;
        for (int i = 2; i <= Math.sqrt(n); i++) {
            for (int j = 2; i * j <= n; j++) {
                if (primes[i] == 1) {
                    primes[i * j] = 0;
                }
            }
        }
        return primes;
    }

    static int fastExponent(int a, int n) {
        if (n == 0) {
            return 1;
        } else if (n == 1) {
            return a;
        } else {
            if (n % 2 == 1) {
                return a * fastExponent(a, n - 1);
            } else {
                return fastExponent(a * a, n / 2);
            }

        }
    }

    static int modExponent(int a, int n, int m) {
        if (n == 0) {
            return 1 % m;
        } else if (n == 1) {
            return a % m;
        } else {
            if (n % 2 == 0) {
                int y = modExponent(a, n / 2, m);
                return (y * y) % m;
            } else {
                return ((a % m) * (modExponent(a, n - 1, m))) % m;
            }
        }
    }

    static int gcd(int a, int b) {
        if (b == 0) {
            return a;
        } else {
            return gcd(b, a % b);
        }
    }

    //ax+by=gcd(a,b) // find x & y
    static int extendedGCD(int a, int b, int x, int y) {
        if (b == 0) {
            x = 1;
            y = 0;
            return a;
        }
        int x1 = 0;
        int y1 = 0;
        int d = extendedGCD(b % a, a, x1, y1);
        x = y1;
        y = x1 - y1 * (a / b);
        return d;
    }

    static int LCM(int a, int b) {
        return ((a * b) / gcd(a, b));
    }

    //find if a number y is a power of x or not
    static boolean isPower(long x,long y){
        if(x==1){
            return (y==1);
        }
        long pow=1;
        while(pow<y){
            pow=pow * x;
        }
        return (pow==y);
    }
    static boolean isLucky(long n){
        long x = n;
        if(n==0){
            return false;
        }
        if(n>0) {

                while (x>0) {
                    if(x%10==8){
                        return true;
                    }
                    x = x/10;
                }

        }
        else{
            //long x = n;
            while (x<0) {
                if(Math.abs(x)%10==8){
                    return true;
                }
                x = x/10;
            }

        }
        return false;
    }
    /* BIGINTEGER JAVA USE
    String x=""+countn;
            BigInteger N=new BigInteger(x);
            System.out.println(N.multiply(BigInteger.valueOf(countm)));
            BigInteger l=sc.nextBigInteger();
            BigInteger r=sc.nextBigInteger();
            System.out.println("YES");
            for (BigInteger bi = l; r.compareTo(bi) > 0; bi = bi.add(BigInteger.valueOf(2))) {
                BigInteger x= bi.add(BigInteger.valueOf(1));
                System.out.println(bi + " "+ x);
            }

            }*/
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        //int n = sc.nextInt();
        //int h=sc.nextInt();
        //int n=sc.nextInt();
        //Map<Integer,Integer> hashmap=new HashMap<>();
        //int[] arr=sieveOfEratosthenes(15);
        //int[] arr = new int[n];
        //ArrayList<Integer> arrayList=new ArrayList<>();
        // Advanced For-Loop
        //for (Integer num : arrlist) {
        //    System.out.println(num);
        //}
        //freq[i]=Integer.parseInt(String.valueOf(charInt[i])); //conversion of char array to int array
        long n=sc.nextLong();
        //System.out.println(n/10);
        int b=0;
        if(n==0){
            System.out.println(8);
        }
        else{
            n++;
            b++;
            while(!isLucky(n)) {
                n++;
                b++;
            }
            if(isLucky(n)){
                System.out.println(b);
            }
        }
    }
    }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class GigaTower {

    /**
     * @param args
     */
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Long n = Long.parseLong(br.readLine());
        n++;
        int ans = 1;
        boolean flag = false;
        while(true) {
            String test = n + "";
            for (int j = 0 ; j < test.length() ; j++)
                if (test.charAt(j) == '8') {
                    flag = true;
                    break;
                }
            if (flag)
                break;
            ans++;
            n++;
        }
        System.out.println(ans);
    }
}

import java.util.Scanner ;

    public class Main {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    double a = input.nextDouble();
    int b = 1;
    a+=1;
    for( int i = 0 ; i <= 17 ; i++){
      if(  isLuky(a) ){
       break ;

     }else{
     b++;
     a++;
   }
   }
   System.out.println(b);
    }
public static boolean isLuky(double n){
   boolean luck = false;
   if(n < 0){
    n = n * -1 ;
   }
   while (n != 0){
      int digit = ((int)(n)) % 10 ;
      n = n / 10 ;
     if(digit == 8){
      luck = true ;
     }
   }

return luck;
}
    }

// package CF;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		long a = sc.nextLong(), b = 0, dx = a < 0?-1:1;
		a = Math.abs(a);
		while(true){
			a += dx; b++;
			boolean can = false;
			long tmp = a;
			while(tmp > 0 && !can){
				can |= tmp % 10 == 8;
				tmp /= 10;
			}
			if(can)
				break;
			if(a == 0)
				dx *= -1;
		}
		out.println(b);
		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader fileReader) {
			br = new BufferedReader(fileReader);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}

import sun.nio.cs.ext.MacThai;

import java.awt.image.BandedSampleModel;
import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        Long val = Long.valueOf(a);
        Long answer = new Long(0);

        for(Long i=new Long(1);;i++){
            val = Long.valueOf(a) + i;

            String temp = val.toString();
            if(temp.contains("8")){
                answer = i;
                break;
            }
        }
        System.out.println(answer);

    }

}

import java.util.Scanner;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author bitver
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {

    boolean has8(long n){
        n = Math.abs(n);

        while (n != 0){
            if (n%10 == 8){
                return true;
            }
            n/=10;
        }
        return false;
    }

    public void solve(int testNumber, Scanner in, PrintWriter out) {
        long l = in.nextLong();

        long b = 1;
        l++;

        while(!has8(l)){
            b++;
            l++;
        }
        out.print(b);

    }
}

import java.util.*;
import java.math.*;
public class Solution{
	public static boolean has_8(long a){
		a  = Math.abs(a);
		boolean k = false;
		while(a>0){
			if(a%10 == 8){
				k = true;
				return k;
			}
			a/=10;
		}
		return k;
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
			for(int i = 1;i<=16;i++){
				if(has_8(a+i)){
					System.out.println(i);
					break;
				}
			}
	}
}

import java.util.Scanner;

public class A_Giga_Tower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		int n = input.nextInt();
		int rep = 1;
		n++;
		while(!isLucky(n)) {
			n++;
			rep++;
		}
		System.out.println(rep);
		input.close();
	}

	public static boolean isLucky(int n) {
		n = Math.abs(n);
		while(n > 0) {
			if(n % 10 == 8) {
				return true;
			}
			n /= 10;
		}
		return false;
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
public class Sagar {
	public static void main (String[] args) {

		Scanner sc=new Scanner(System.in);

		String s=sc.nextLine();

		String z1=s;

		if(s.contains("8")) {

			int x=Integer.parseInt(s)+1;
			if(Integer.toString(x).contains("8")) {
				System.out.println(1);
			}
			else {

				int cnt=1;

				while(true) {

					x+=1;
					cnt+=1;
					if(Integer.toString(x).contains("8")) {
						System.out.println(cnt);
						break;
					}

				}
			}

		}

		else {

			int n=Integer.parseInt(s);

			int cnt=0;

			while(true) {

				n+=1;
				cnt++;
				String z=Integer.toString(n);
				if(z.contains("8")) {
					System.out.println(cnt);
					break;
				}

			}

		}

	}
}

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class D {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        long l = Long.parseLong(bf.readLine());
        for(int i=1; i<=20; i++) {
            l++;
            String s = l+"";
            if(s.indexOf('8') != -1) {
                System.out.println(i);
                System.exit(0);
            }
        }
        // Scanner scan = new Scanner(System.in);
        // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        // StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        // int n = Integer.parseInt(st.nextToken());
        // int n = scan.nextInt();

        // out.close(); System.exit(0);
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ivan
 */
public class firstProblem {

    static boolean isLucky(String string)
    {
        int length=string.length();
        for(int i=0;i<length;i++)
            if(string.charAt(i)=='8')
                return true;
        return false;
    }
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        String a=Reader.next();
        long number=Long.parseLong(a);
        int count=1;
        number++;
        while(!isLucky(Long.toString(number)))
        {
            number++;
            count++;
        }

        System.out.println(count);

    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}

import java.util.Scanner;

public class CodeForce278 {
    static boolean ast(Long a)
    {
        String S=a.toString();
        for(int i=0;i<S.length();i++)
            if(S.charAt(i) == '8') return true;

        return false;
    }
    public static void main(String[] args) {
        int b=0;

        Scanner S = new Scanner(System.in);
        long a = S.nextLong();
        while(true)
        {
            a++;
            b++;
            if(ast(a)) break;
        }
        System.out.println(b);
    }
}

import java.util.Scanner;

public class TestRun {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();

        int b=0;

        long i=1;
        long temp=a;
        long ten=10;
        boolean flag=true;

        T:
        while(flag&&(Long.toString(Math.abs(a)).length())>=i){
            temp=Math.abs(a)%ten;
            if(temp/(ten/10)==8){
                b++;
                a++;
                long j=1;
                long temp1=0;
                long ten1=10;
                while(flag&&(Long.toString(Math.abs(a)).length())>=j){
                    temp1=Math.abs(a)%ten1;
                    if(temp1/(ten1/10)==8){
                        System.out.println(b);
                        System.exit(0);
                    }

                    ten1 *= 10;
                    j++;
                }

            }
            else{
                ten*=10;
                i++;
            }

        }

        long r8h=a;
        int r8=0;

        if(Math.abs((a%10))==8){
                b+=10;
                System.out.println(b);
                System.exit(0);
            }

        while(Math.abs((a%10))!=8){

            b++;
            a++;

            r8h=a%100;
            r8=(int) (r8h/10);
            if(Math.abs(r8)==8){
                //b++;
                break;
            }
        }

        System.out.println(b);
    }
}

import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.FileReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.Writer;
import java.util.StringTokenizer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Ravi1G
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Reader in = new Reader(inputStream);
        MyWriter out = new MyWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, Reader in, MyWriter out) {
        long n = in.nextLong();

        long result =0;
        while(true){
            n++; result++;
            if(isLucky(String.valueOf(n))) break;
        }
        out.println(result);
    }

    public static boolean isLucky(String s){
        return s.contains("8");
    }
}

class Reader {
    private BufferedReader input;
    private StringTokenizer line = new StringTokenizer("");

    public Reader() {
        input = new BufferedReader(new InputStreamReader(System.in));
    }

    public Reader(InputStream is){
        input = new BufferedReader(new InputStreamReader(is));
    }

    public Reader(String s) {
        try {
            input = new BufferedReader(new FileReader(s));
        } catch(IOException io) { io.printStackTrace(); System.exit(0);}
    }

    public void fill() {
        try {
            if(!line.hasMoreTokens()) line = new StringTokenizer(input.readLine());
        } catch(IOException io) { io.printStackTrace(); System.exit(0);}
    }

    public long nextLong() {
        fill();
        return Long.parseLong(line.nextToken());
    }

}

class MyWriter {

    private BufferedWriter output;

    public MyWriter() {
        output = new BufferedWriter(new OutputStreamWriter(System.out));
    }

    public MyWriter(OutputStream os){
        output = new BufferedWriter(new OutputStreamWriter(os));

    }

    public MyWriter(java.io.Writer wr){
        output = new BufferedWriter(wr);
    }
    public MyWriter(String s) {
        try {
            output = new BufferedWriter(new FileWriter(s));
        } catch(Exception ex) { ex.printStackTrace(); System.exit(0);}
    }

    public void println(Object o) {
        try {
            output.append(o.toString()+"\n");
        } catch(IOException io) { io.printStackTrace(); System.exit(0);}
    }

    public void flush() {
        try {
            output.flush();
        } catch(IOException io) { io.printStackTrace(); System.exit(0);}
    }

    public void close() {
        try {
            output.flush();
            output.close();
        } catch(IOException io) { io.printStackTrace(); System.exit(0);}
    }
}

import java.util.Scanner;
public class Test {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		double a=sc.nextDouble();
		if(a>=0)
			for(int i=1;i<=16;i++){
			if(ismagic(a+i)){
				System.out.println(i);
				return;
			}
		}
		else if(a>=-8){
			a=-a;
			System.out.println((int)(a+8));
		}
		else{
			a=-a;
			for(int i=1;i<=16;i++){
				if(ismagic(a-i)){
					System.out.println(i);
					return;
				}
			}
		}
	}
	public static boolean ismagic(double a){
		while(a!=0){
			if(a%10==8) return true;
			a=(int)a/10;
		}
		return false;
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

    public static void main (String []args)throws IOException
    {
        BufferedReader in = new BufferedReader (new InputStreamReader(System.in));

        int T = Integer.parseInt(in.readLine());
        int Z = T;
        int counter = 0;
       String A;
        A = (T)+"";
        if(A.contains("8"))
        {

            A=(T+1)+"";
            if(A.contains("8"))counter=1;
        }

        while(!A.contains("8"))
        {

             ++T;
            A=T+"";

            counter++;

        }
        System.out.println(counter);
        }

}

import java.util.*;
import java.math.*;
public class Solution{
	public static boolean has_8(long a){
		a  = Math.abs(a);
		boolean k = false;
		while(a>0){
			if(a%10 == 8){
				k = true;
				return k;
			}
			a/=10;
		}
		return k;
	}

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		if(a == -8){
			System.out.println("16");
		}
		else{
			for(int i = 1;i<=10;i++){
				if(has_8(a+i)){
					System.out.println(i);
					break;
				}
			}
		}
	}
}

import java.util.Scanner ;

    public class Main {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    int a = input.nextInt();
    int b = 0;
    a+=1;
    for( int i = 0 ; i < 10 ; i++){
      if(  isLuky(a) ){
       break ;

     }else{
     b++;
     a++;
   }
   }
   System.out.println(b+1);
    }
public static boolean isLuky(int n){
   boolean luck = false;
   if(n < 0){
    n = n * -1 ;
   }
   while (n != 0){
      int digit = n % 10 ;
      n = n / 10 ;
     if(digit == 8){
      luck = true ;
     }
   }

return luck;
}
    }

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int res = 0;
        for(int i = n; !check(i); ++i) ++res;
        out.println(res);
    }

    boolean check(int number){
        int digit;
        while(number > 0){
            digit = number%10;
            number/=10;
            if(digit == 8) return true;
        }
        return false;
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }

}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Main {

	InputStream is;
	PrintWriter out;
	String INPUT = "";

	private static final long M = 1000000007L;

	void solve() {
		StringBuffer sb = new StringBuffer();
		long N = ni();
		for (int ans = 1; ans <= 12; ans++) {
			if (isLucky(N + ans)) {
				out.println(ans);
				break;
			}
		}
	}

	private boolean isLucky(long l) {
		while (l > 0) {
			if (l % 10 == 8)
				return true;
			l /= 10;
		}
		return false;
	}

	private long gcd(long a, long b) {
		while (a != 0) {
			long tmp = b % a;
			b = a;
			a = tmp;
		}
		return b;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n) {
			if (!(isSpaceChar(b)))
				buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private Integer[] na2(int n) {
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private Integer[][] na(int n, int m) {
		Integer[][] a = new Integer[n][];
		for (int i = 0; i < n; i++)
			a[i] = na2(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class project
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static int binarySearch(long a[],long k,int l,int h){
        int min = Integer.MAX_VALUE;
        while(l<=h){
         int mid = (l+h)/2;
         if(a[mid]==k) return mid;
         else if(a[mid]>k) h=mid-1;
         else if(a[mid]<k) l =mid+1;
    }

        return min;
    }

    static int gcd(int a, int b)
    {
        // Everything divides 0
        if (a == 0)
          return b;
        if (b == 0)
          return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        if (a > b)
            return gcd(a-b, b);
        return gcd(a, b-a);
    }

    public static void main(String[] args) throws Exception
    {

        FastReader sc = new FastReader();
        int i,j=0;

        int n = sc.nextInt();
        int t=n;
        int d=0;
        int r;
        if(n<0) {t=0; d=Math.abs(n);}

        if(t%10<8){
            d += 8 - (t%10);
        }
        else if(t%10==8){
            d+=10;
        }
        else if(t%10>8){
            t=t/10;
            if(((t/10)%10) == 7) d=1;
            else d=8;
        }

        System.out.print(d);

}

}

// System.out.println();

import java.util.*;
import java.lang.*;
import java.io.*;
public class Sagar {
	public static void main (String[] args) {

		Scanner sc=new Scanner(System.in);

		String s=sc.nextLine();

		String z1=s;

		if(Integer.parseInt(s)<0) {
			System.out.println(1);
		}

		else if(s.contains("8")) {
			System.out.println(10);
		}
		else {

			int n=Integer.parseInt(s);

			int cnt=0;

			while(true) {

				n+=1;
				cnt++;
				String z=Integer.toString(n);
				if(z.contains("8")) {
					System.out.println(cnt);
					break;
				}

			}

		}

	}
}

import java.util.Scanner;

public class A_Giga_Tower_Round278 {

	static boolean che(int x) {
		while (x > 0) {
			if (x % 10 == 8 || x % 10 == -8)
				return true;
			x /= 10;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner x = new Scanner(System.in);
		int num  = x.nextInt() , value = num;

		value++;

		while (!che(value)) {
			value++;
		}

		System.out.print(value - num);

	}
}

import java.util.*;
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in=new Scanner(System.in);
		long a=in.nextLong();
		int c=0;
		String s=String.valueOf(a);
		if(s.contains("8"))
		    s=String.valueOf(a+1);
		while(!(s.contains("8"))){
		    a+=1;
		    s=String.valueOf(a);
		    c++;
		}
		System.out.println(c);
	}
}

import java.util.*;
import java.io.*;
import java.math.*;
//String.format("%.10f", new BigDecimal(ans))
public class Main {
    InputReader ir;
    void solve() {
        ir = new InputReader(System.in);
        int n = ir.readInt();
        for(int i = 1; i <= 10; i++) {
            if(check(n + i) == true) {
                System.out.println(i);
                return;
            }
        }

    }
    boolean check(int n) {
        while(n != 0) {
            int last = n %10;
            if(last == 8)
                return true;
            n /= 10;
        }
        return false;
    }
    public static void main(String[] args) {
        new Main().solve();
    }
}
class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }
        public final int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }
        public double readDouble() {
        return Double.parseDouble(readString());
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

import java.util.*;
import java.math.*;
import java.lang.*;
public class main{

  public static void main(String[] args) {
           Scanner cin = new Scanner(System.in);
      String str=cin.nextLine();
        System.out.println(b(str));
      }

      public static int b(String str){
               boolean nines=true,neg=false;
               if (str.charAt(0)=='-')neg=true;
              if(!neg){
                boolean e=false;
                int i=0,x=-1;
                for (int j = str.length()-1 ; j>=0 ;--j){

                  if (str.charAt(j)=='9'&&nines)i++;

                  else {
                    if (j==str.length()-1&&str.charAt(j)=='8')e=true;
                    else{
                      nines=false;
                       if (str.charAt(j)=='8')
                      x=str.length()-(j+1);
                }
                }
              }
        if((str.charAt(str.length()-(i+1))=='7'&&!e)||(x!=-1&&x!=i))return 1;
        if (str.charAt(str.length()-1)<'8')return (int)('8'-str.charAt(str.length()-1));
        if (str.charAt(str.length()-1)=='9')return 9;
        if (str.length()>=2&&e&&str.charAt(str.length()-(i+2))=='7')return 2;
         return 10;
       }
       else {
         int i=0,x=-1;
         for (int j = str.length()-1 ; j>=0 ;--j){

           if (str.charAt(j)=='0'&&nines)i++;

           else {
             nines=false;
             if (str.charAt(j)=='8')x=str.length()-(j+1);
           }
         }
         if (str.charAt(str.length()-2)=='9'&&str.charAt(str.length()-1)<'4')return ((int)str.charAt(str.length()-1)-'0')+1;
 if(str.charAt(str.length()-(i+1))=='9'||(x!=-1&&x!=i))return 1;
         if (str.length()==2&&str.charAt(1)<'9')return ((int)(str.charAt(1)+'8')-(2*'0'));
         if(str.charAt(str.length()-(i+1))=='9')return 1;
         if (str.charAt(str.length()-1)<'8')return (int)((str.charAt(str.length()-1)-'8')+10);
         if (str.charAt(str.length()-1)=='9')return 1;
          return 10;
       }
      }

  }

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 108
 287

 *
 * */
public class Main
{
	public static void main(String[]arg) throws IOException
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		long n = Integer.parseInt(in.readLine());
		long np = n;
		int ans = 0;
		String  b = ""+n;
		if(b.contains("8"))
		{
			b = ""+(n+1);
		}
		while(!b.contains("8"))
		{
			ans++;
			n++;
			b = "" + n;
		}
		System.out.println(ans);
	}

}

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		boolean band = true;
		int c = 0;
		while (band) {
			String cad = String.valueOf(a);
			if (cad.contains("8")) {
				band = false;
				break;
			}
			a++;
			c++;
		}
		System.out.println(c == 0 ? "10" : c);
	}
}

import java.util.Scanner;

public class GigaTower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		long a;
		Scanner sc = new Scanner(System.in);
		a = sc.nextLong();
		for(int i = 1; i <= 10; i++){
			String str = String.valueOf(a+i);
			if (str.contains("8")){
				System.out.println(i);
				break;
			}
		}
	}

}

import java.util.Scanner;
import java.util.Arrays;
public class Gigatower{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int b=0;
		for(int i=1;i<20;i++)
		{
			int check=0;
			int n1=n+i;
			while(n1!=0)
			{
				int x=n1%10;
				if(x==8) {
					check=1;
					break;
				}
				n1/=10;
			}
			if(check==1)
			{
				b=i;
				break;
			}
		}
		System.out.println(b);
	}
}

import java.util.*;

public class giga
{
	public static void main(String[] arg)
	{
		Scanner in = new Scanner(System.in);
		long current = in.nextLong();
		long count = 0;
		while(!isLucky(current) || count == 0)
		{
			current++;
			count++;
		}
		System.out.println(count);
	}

	public static boolean isLucky(long number)
	{
		while(number > 0)
		{
			long temp = number%10;
			if(temp == 8)
				return true;
			number /=10;
		}
		return false;
	}
}

import java.util.Scanner;

public class Cf{

static String check(String s){

	    if (s.length() > 2){
OUT:		for (int i = 0; i < s.length()-1; i++){
			if (s.charAt(i) == '8'){
				System.out.println(1);
				s = "";
				break OUT;
			}
		}
	    }

return s;
}
public static void main(String args[]){

Scanner in = new Scanner(System.in);

String s = in.next();

	if (s.charAt(0) != '-'){

		s = check(s);
		if (s != ""){
			int b = Character.getNumericValue(s.charAt(s.length()-1));
			int z = 0;
			if (s.length()>1){
			  z = Character.getNumericValue(s.charAt(s.length()-2));
			  System.out.println((b==9)?((z==7)?(1):(9)):(18-b));
			}else{
			  System.out.println((b<8)?(8-b):(18-b));
			}
		}

	}else{
		s = check(s);
		if (s != ""){
			int b = Character.getNumericValue(s.charAt(s.length()-1));
			int z = 0;
			if (s.length()>2){
			 z = Character.getNumericValue(s.charAt(s.length()-2));
			 System.out.println((b==0)?((z==9)?(1):(2)):((b>8)?(b-8):(b+3)));
			}else{
			 System.out.println((b==9)?(1):(b+8));
			}
		}

	}

  }
}

import java.util.*;
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in=new Scanner(System.in);
		long a=in.nextLong();
		int c=0;
		String s=String.valueOf(a+1);
		while(!(s.contains("8"))){
		    a+=1;
		    s=String.valueOf(a);
		    c++;
		}
		System.out.println(c);
	}
}

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class q5 {

	 public static int gcd(int a,int b) {
		 if(b==0) return a;
		 else return gcd(b,a%b);
	 }

	 // Credits to GFG
	 static long power(long x, long y, long p)
	    {
	        // Initialize result
	        long res = 1;

	        // Update x if it is more
	        // than or equal to p
	        x = x % p;

	        while (y > 0)
	        {
	            // If y is odd, multiply x
	            // with result
	            if((y & 1)==1)
	                res = (res * x) % p;

	            // y must be even now
	            // y = y / 2
	            y = y >> 1;
	            x = (x * x) % p;
	        }
	        return res;
	    }

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Reader.init(System.in);
		StringBuffer output=new StringBuffer("");
		PrintWriter out=new PrintWriter(System.out);
		long a=Reader.nextLong();
		boolean found=false;
		int ans=0;
		for(int i=0;i<=20;i++) {
			long b=a+i;
			String s=Long.toString(b);
			for(int j=0;j<s.length();j++) {
				if(s.charAt(j)=='8') {
					found=true;
					ans=i;
					break;
				}
			}
			if(found) break;
		}
		output.append(ans);
		out.write(output.toString());
		out.flush();

	}
}

class Node2{
	int x;
	int y;
	Node2(int v, int d){
		x=v;y=d;
	}

}

class Heap{
	int[] mylist;
	int[] mymap;
	int[] vtxmymap;
	int size;
	long[] update;
	long updatevalue;
	int[] removed;
	Heap(int[] graph){
		int l=graph.length;
		updatevalue=0;
		removed=new int[l];
		update=new long[l];
		size=l-1;
		mylist=new int[l];
		mymap=new int[l];
		vtxmymap=new int[l];
		for(int i=size;i>0;i--) {
			if(i>size/2) {
				mylist[i]=graph[i];
				mymap[i]=i;
				vtxmymap[i]=i;
			}
			else {
				mylist[i]=graph[i];
				mymap[i]=i;
				vtxmymap[i]=i;
				boolean end=false;
				int parent=i;
				while(!end) {
					int leftchild=2*parent;
					int rightchild=2*parent+1;
					if(leftchild>size) {
						end=true;
					}
					else if(rightchild>size) {
						if(mylist[leftchild]<mylist[parent]) {
							int parentNode=vtxmymap[parent];
							int childNode=vtxmymap[leftchild];
							int parentDeg=mylist[parent];
							int childDeg=mylist[leftchild];
							mylist[parent]=childDeg;
							mylist[leftchild]=parentDeg;
							mymap[parentNode]=leftchild;
							mymap[childNode]=parent;
							vtxmymap[parent]=childNode;
							vtxmymap[leftchild]=parentNode;
							parent=leftchild;
						}
						else end=true;
					}
					else {
						if(mylist[leftchild]<=mylist[rightchild]) {
							if(mylist[leftchild]<mylist[parent]) {
								int parentNode=vtxmymap[parent];
								int childNode=vtxmymap[leftchild];
								int parentDeg=mylist[parent];
								int childDeg=mylist[leftchild];
								mylist[parent]=childDeg;
								mylist[leftchild]=parentDeg;
								mymap[parentNode]=leftchild;
								mymap[childNode]=parent;
								vtxmymap[parent]=childNode;
								vtxmymap[leftchild]=parentNode;
								parent=leftchild;
							}
							else end=true;
						}
						else {
							if(mylist[rightchild]<mylist[parent]) {
								int parentNode=vtxmymap[parent];
								int childNode=vtxmymap[rightchild];
								int parentDeg=mylist[parent];
								int childDeg=mylist[rightchild];
								mylist[parent]=childDeg;
								mylist[rightchild]=parentDeg;
								mymap[parentNode]=rightchild;
								mymap[childNode]=parent;
								vtxmymap[parent]=childNode;
								vtxmymap[rightchild]=parentNode;
								parent=rightchild;
							}
							else end=true;
						}
					}
				}
			}
		}
	}

	void update(int child) {
		if(update[child]==updatevalue) return;
		boolean end=false;
		while(!end) {
			update[child]=updatevalue;
			int parent=child/2;
			if(parent<1) end=true;
			else {
				if(mylist[parent]>mylist[child]) {
					int parentNode=vtxmymap[parent];
					int childNode=vtxmymap[child];
					int parentDeg=mylist[parent];
					int childDeg=mylist[child];
					mylist[parent]=childDeg;
					mylist[child]=parentDeg;
					mymap[parentNode]=child;
					mymap[childNode]=parent;
					vtxmymap[parent]=childNode;
					vtxmymap[child]=parentNode;
					parent=child;
				}
				else end=true;
			}
		}
	}

	int peek() {
		return mylist[1];
	}

	int pop() {
		int toreturn=mylist[1];
		removed[vtxmymap[1]]=1;
		mylist[1]=mylist[size];
		int changedNode=vtxmymap[size];
		vtxmymap[1]=changedNode;
		mymap[changedNode]=1;
		boolean end=false;
		size--;
		if(size==0) end=true;
		int parent=1;
		while(!end) {
			int leftchild=2*parent;
			int rightchild=2*parent+1;
			if(leftchild>size) {
				end=true;
			}
			else if(rightchild>size) {
				if(mylist[leftchild]<mylist[parent]) {
					int parentNode=vtxmymap[parent];
					int childNode=vtxmymap[leftchild];
					int parentDeg=mylist[parent];
					int childDeg=mylist[leftchild];
					mylist[parent]=childDeg;
					mylist[leftchild]=parentDeg;
					mymap[parentNode]=leftchild;
					mymap[childNode]=parent;
					vtxmymap[parent]=childNode;
					vtxmymap[leftchild]=parentNode;
					parent=leftchild;
				}
				else end=true;
			}
			else {
				if(mylist[leftchild]<=mylist[rightchild]) {
					if(mylist[leftchild]<mylist[parent]) {
						int parentNode=vtxmymap[parent];
						int childNode=vtxmymap[leftchild];
						int parentDeg=mylist[parent];
						int childDeg=mylist[leftchild];
						mylist[parent]=childDeg;
						mylist[leftchild]=parentDeg;
						mymap[parentNode]=leftchild;
						mymap[childNode]=parent;
						vtxmymap[parent]=childNode;
						vtxmymap[leftchild]=parentNode;
						parent=leftchild;
					}
					else end=true;
				}
				else {
					if(mylist[rightchild]<mylist[parent]) {
						int parentNode=vtxmymap[parent];
						int childNode=vtxmymap[rightchild];
						int parentDeg=mylist[parent];
						int childDeg=mylist[rightchild];
						mylist[parent]=childDeg;
						mylist[rightchild]=parentDeg;
						mymap[parentNode]=rightchild;
						mymap[childNode]=parent;
						vtxmymap[parent]=childNode;
						vtxmymap[rightchild]=parentNode;
						parent=rightchild;
					}
					else end=true;
				}
			}
		}

		return toreturn;
	}

}

 class DisJoint {
		int[] parent;
		int[] rank;
		int[] size;
		DisJoint(int n){

			parent=new int[n+1];
			rank=new int[n+1];
			for(int i=0;i<=n;i++) {
				parent[i]=i;
			}
		}

		int find(int value) {
			int par=parent[value];
			if(par==value)
				return par;
			parent[value]=find(par);
			return parent[value];
		}

		void union(int data1,int data2) {
			int parent1=find(data1);
			int parent2=find(data2);
			if(parent1!=parent2) {
				if(rank[parent1]>=rank[parent2]) {
					parent[parent2]=parent1;
					if(rank[parent1]==rank[parent2])
						rank[parent1]++;
				}
				else {
					parent[parent1]=parent2;
		}

		}
		}
}

 class Reader {
	    static BufferedReader reader;
	    static StringTokenizer tokenizer;

	    /** call this method to initialize reader for InputStream */
	    static void init(InputStream input) {
	        reader = new BufferedReader(
	                     new InputStreamReader(input) );
	        tokenizer = new StringTokenizer("");
	    }

	    /** get next word */

	    static String next() throws IOException {
	        while ( ! tokenizer.hasMoreTokens() ) {
	            //TODO add check for eof if necessary
	            tokenizer = new StringTokenizer(
	                   reader.readLine() );
	        }
	        return tokenizer.nextToken();
	    }

	    static int nextInt() throws IOException {
	        return Integer.parseInt( next() );
	    }
	    static long nextLong() throws IOException {
	        return Long.parseLong( next() );
	    }
	    static double nextDouble() throws IOException {
	        return Double.parseDouble( next() );
	    }
	}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h )
            System.out.println(1);
        else if ( r == 8 )
            System.out.println(10);
        else
            System.out.println(Math.abs(r - 8));
//        else
//            System.out.println(10);
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class CF278A {
	private FastScanner in;
	private PrintWriter out;

	public void solve() throws IOException {
		long a = in.nextLong();
		String s = a + "";
		int chk = 0;
		for (int i = s.length()-1; i >= 0; i--){
			if (s.charAt(i) == '9'){
				chk = 1;
			}
			else if (s.charAt(i) == '7' && chk == 1){
				out.println(1);
				return;
			}
			else {
				if (a == -8){
					out.println(16);
					return;
				}
				out.println(8 - a%8);
				return;
			}
		}
	}

	public static void main(String[] args) {
		new CF278A().run();
	}

	public void run() {
		try {
			in = new FastScanner();
			out = new PrintWriter(System.out);
			solve();
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	private class FastScanner {
		private BufferedReader br;
		private StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}

/* package whatever; // don't place package name! */

import java.util.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static Integer gcd(Integer a, Integer b)
	{
		if(b==0) return a;
		return gcd(b, a%b);
	}

	public static void main(String[] args) throws java.lang.Exception{
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		Integer n = sc.nextInt();
		if(n>=0)
		{
			Integer a = n/10;
			String s = a.toString();
			int count = 0;
			for(int i = 0;i<s.length();i++)
			{
				if(s.charAt(i)=='8')
				{
					break;
				}
				else
				{
					count++;
				}
			}
			if(count!=s.length())
			{
				if(n%100==89)
				{
					out.println(9);
				}
				else
				{
					out.println(1);
				}
			}
			else
			{
				if(n%10==9)
				{
					if(n%100==79)
					{
						out.println(1);
					}
					else
					{
						out.println(9);
					}
				}
				else if(n%10==8)
				{
					if(n%100==78)
					{
						out.println(2);
					}
					else
					{
						out.println(10);
					}
				}
				else
				{
					out.println(8-(n%10));
				}
			}
		}
		else
		{
			Integer a = n/10;
			String s = a.toString();
			int count = 0;
			for(int i = 0;i<s.length();i++)
			{
				if(s.charAt(i)=='8')
				{
					break;
				}
				else
				{
					count++;
				}
			}
			if(count!=s.length())
			{
				if(n%100==-80)
				{
					out.println(2);
				}
				else
				{
					out.println(1);
				}
			}
			else
			{
				if(n%100==-80+(n%10))
				{
					out.println((n%10)*-1);
				}
				else if(n%100==-90+(n%10))
				{
					out.println(((n%10)*-1)+1);
				}
				else if(n%10==-9&&n%100!=n%10)
				{
					out.println(1);
				}
				else if(n%10==0&&n%100!=n%10)
				{
					out.println(2);
				}
				else if(n%10==-8&&n%100!=n%10)
				{
					out.println(10);
				}
				else if(n%100==n%10)
				{
					out.println(((n%10)*-1)+8);
				}
				else
				{
					out.println(((n%10)*-1)+2);
				}
			}
		}
		out.close();
    }

	static class MyScanner{
        StringTokenizer st;
        BufferedReader br;
        public MyScanner(){br = new BufferedReader(new InputStreamReader(System.in));}
        public MyScanner(FileReader s) throws FileNotFoundException {	br = new BufferedReader(s);}
        public String next() throws IOException{
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        public int nextInt() throws IOException {return Integer.parseInt(next());}
        public long nextLong() throws IOException {return Long.parseLong(next());}
        public String nextLine() throws IOException {return br.readLine();}
        public double nextDouble() throws IOException { return Double.parseDouble(next()); }
        public boolean ready() throws IOException {return br.ready();}
    }
}

import java.util.Arrays;
import java.util.Scanner;

public class A {
	MyScanner sc = new MyScanner();
	Scanner sc2 = new Scanner(System.in);
	long start = System.currentTimeMillis();
	long fin = System.currentTimeMillis();
	final int MOD = 1000000007;
	int[] dx = { 1, 0, 0, -1 };
	int[] dy = { 0, 1, -1, 0 };

	void run() {
		long a = sc.nextLong() + 1;
		int cnt = 1;
		while (true) {
			long aa = a;
			while (aa > 0) {
				if (aa % 10 == 8) {
					System.out.println(cnt);
					return;
				}
				aa /= 10;
			}
			a++;
			cnt++;
		}
	}

	public static void main(String[] args) {
		new A().run();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(char[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}

	boolean inner(int h, int w, int limH, int limW) {
		return 0 <= h && h < limH && 0 <= w && w < limW;
	}

	void swap(int[] x, int a, int b) {
		int tmp = x[a];
		x[a] = x[b];
		x[b] = tmp;
	}

	// find minimum i (a[i] >= border)
	int lower_bound(int a[], int border) {
		int l = -1;
		int r = a.length;
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (border <= a[mid]) {
				r = mid;
			} else {
				l = mid;
			}
		}
		// r = l + 1
		return r;
	}

	boolean palindrome(String s) {
		for (int i = 0; i < s.length() / 2; i++) {
			if (s.charAt(i) != s.charAt(s.length() - 1 - i)) {
				return false;
			}
		}
		return true;
	}

	class MyScanner {
		int nextInt() {
			try {
				int c = System.in.read();
				while (c != '-' && (c < '0' || '9' < c))
					c = System.in.read();
				if (c == '-')
					return -nextInt();
				int res = 0;
				do {
					res *= 10;
					res += c - '0';
					c = System.in.read();
				} while ('0' <= c && c <= '9');
				return res;
			} catch (Exception e) {
				return -1;
			}
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		String next() {
			try {
				StringBuilder res = new StringBuilder("");
				int c = System.in.read();
				while (Character.isWhitespace(c))
					c = System.in.read();
				do {
					res.append((char) c);
				} while (!Character.isWhitespace(c = System.in.read()));
				return res.toString();
			} catch (Exception e) {
				return null;
			}
		}

		int[] nextIntArray(int n) {
			int[] in = new int[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextInt();
			}
			return in;
		}

		int[][] nextInt2dArray(int n, int m) {
			int[][] in = new int[n][m];
			for (int i = 0; i < n; i++) {
				in[i] = nextIntArray(m);
			}
			return in;
		}

		double[] nextDoubleArray(int n) {
			double[] in = new double[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextDouble();
			}
			return in;
		}

		long[] nextLongArray(int n) {
			long[] in = new long[n];
			for (int i = 0; i < n; i++) {
				in[i] = nextLong();
			}
			return in;
		}

		char[][] nextCharField(int n, int m) {
			char[][] in = new char[n][m];
			for (int i = 0; i < n; i++) {
				String s = sc.next();
				for (int j = 0; j < m; j++) {
					in[i][j] = s.charAt(j);
				}
			}
			return in;
		}
	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * Created by Egor on 21/11/14.
 */
public class TaskA {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int a = Integer.parseInt(reader.readLine());
        int i0 = 1;
        if (a < 0) {
            i0 = -a + 1;
            a = 0;
        }

        for (int i = i0; i <= 2000000999; i++) {
            a++;
            if (String.valueOf(a).contains("8")) {
                System.out.println(i);
                System.exit(0);
            }
        }
        throw new AssertionError();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Ivan
 */
public class firstProblem {

    static boolean isLucky(String string)
    {
        int length=string.length();
        for(int i=0;i<length;i++)
            if(string.charAt(i)=='8')
                return true;
        return false;
    }
    public static void main(String[] args) throws IOException {
        Reader.init(System.in);
        String a=Reader.next();
        if(isLucky(a))
        {
            System.out.println("0");
            return;
        }
        long number=Long.parseLong(a);
        int count=0;
        while(!isLucky(Long.toString(number)))
        {
            number++;
            count++;
        }

        System.out.println(count);

    }

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
}

import java.util.Scanner;

public class ProblemA {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

	}

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        long t = b ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h && ( r != 9 && t/10 != 8 ) )
            System.out.println(1);
        else if ( t/10 == 8  )
            System.out.println( 10 - r );
        else if ( r > 7 && t > 0 )
            System.out.println(18 - r );
        else if ( t > 0 )
            System.out.println(Math.abs(r - 8));
        else if ( r == 9 )
            System.out.println(1);
        else
            System.out.println( r + 8 );
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class codeforces {
	static PrintWriter out;
	public static void main(String[] args) {
		FS scan = new FS(System.in);
		int N = scan.nextInt();
		for(int i=N+1;i<N+10;i++){
			boolean contains = false;
			int t = i;
			while(t!=0){
				if(t%10==8)contains=true;
				t/=10;
			}
			if(contains){
				System.out.println(i-N);
				return;
			}
		}
	}

	private static class FS {
		BufferedReader br;
		StringTokenizer st;
		public FS(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		String next(){
			while(st==null||!st.hasMoreElements()){
				try{st = new StringTokenizer(br.readLine());}
				catch(IOException e){e.printStackTrace();}
			}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() { return Double.parseDouble(next());}
	}
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        long t = b ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h && ( r != 9 && (t/10)%10 != 8 ) )
            System.out.println(1);
        else if ( (t/10)%10 == 7 && r == 9 )
            System.out.println( 1 );
        else if ( r > 7 && t > 0 )
            System.out.println(18 - r );
        else if ( t > 0 )
            System.out.println(Math.abs(r - 8));
        else if ( r == -9 )
            System.out.println( 1 );
        else if ( r == 0 )
            System.out.println( 2 );
        else
            System.out.println( 8 - r );
    }

}

import java.util.*;
public class GigaTower
{
	public static void main(String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int flag=0;

		int count=0;
			while(true)
			{
				n++;
				count++;
				for(int i=n;i>0;i=i/10)
				{
					if(i%10==8)
					{
						flag=1;
						break;
					}
				}
				if(flag==1)
				{
					break;
				}
			}
			System.out.println(count);

	}
}

import java.util.Scanner;

public class Cf{

public static void main(String args[]){

Scanner in = new Scanner(System.in);

String s = in.next();

	if (s.charAt(s.length()-1) == '8' && (s.charAt(0) != '-') ){
		System.out.println(10);
	}else{
OUT:		for (int i = 0; i < s.length(); i++){
			if (s.charAt(i) == '8'){
				System.out.println(1);
				s = "";
				break OUT;
			}
		}

		if (s != ""){
			if (s.charAt(0) == '-'){
				System.out.println(8 + Math.abs(Integer.parseInt(s)));
			}else{
				int b = Character.getNumericValue(s.charAt(s.length()-1));
				System.out.println((b==9)?((s.charAt(s.length()-2) == '7') ? (1) : (9)):(8-b));
			}
		}

	}

  }
}

import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		boolean band = true;
		int c = 0;
		while (band) {
			String cad = String.valueOf(a);
			if (cad.contains("8")) {
				band = false;
				break;
			}
			a++;
			c++;
		}
		System.out.println(c == 0 ? "10" : c);
	}
}

import java.util.*;
public class Q488A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong();
		long b = 0;
		for(b=1;b<=100;b++){
			long t = a+b;
			boolean f=false;
			while(t!=0){
				if(t%10 == 8){
					f=true;
					break;
				}

				t=t/10;
			}
			if(f)
				break;
		}
		System.out.println(b);
	}

}

import java.util.*;
import java.io.*;
public class GigaTower
{
    public static void main(String []args) throws IOException {
	FastScanner in  = new FastScanner(System.in);
	FastWriter  out = new FastWriter(System.out);
	solve(in, out);
	in.close();
	out.close();
    }
    private static boolean isLucky(long n)
    {
	while(n>0)
	{
	    if(n%10 == 8)
		return true;

	    n /= 10;
	}
	return false;
    }
    private static void solve(FastScanner s1, FastWriter out)/* This is the actual solution */{

	long n = s1.nextLong();
	if(n>=0)
	{
	if((n%10) < 8)
	{
	    long rest = n/10;
	    if(isLucky(rest))
		out.print("1");
	    else
		out.print(8-(n%10));
	}
	else
	{
	    long rest = (n/10) + 1;
	    long new_n;
	    if(isLucky(rest))
		new_n = (rest*10);
	    else
		new_n = (rest*10)+8;

	    out.print((new_n-n));
	}
	}
	else
	{
	    n = -n;
	    if(n<=8)
	    {
		out.print(n+8);
	    }
	    else if(n%10 == 9)
		out.print("1");
	    else
	    {
		long rest = n/10;
		if(isLucky(rest) && (n%10 != 0))
		    out.print("1");
		else
		{
		    rest = (n/10) - 1;
		    if(isLucky(rest))
			out.print((n%10)+1);
		    else
		    {
			out.print((n%10)+2);  //(10+MOD)-8
 		    }
		}
	    }
	}

    }

    static class FastScanner{
	public BufferedReader reader;
	public StringTokenizer st;
	public FastScanner(InputStream stream){
	    reader = new BufferedReader(new InputStreamReader(stream));
	    st = null;
	}
	public String next(){
	    while(st == null || !st.hasMoreTokens()){
		try{
		    String line = reader.readLine();
		    if(line == null) return null;
		    st = new StringTokenizer(line);
		}catch (Exception e){
		    throw (new RuntimeException());
		}
	    }
	    return st.nextToken();
	}
	public String nextLine(){
            String str = null;
            try {
                str = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
	public int nextInt(){
	    return Integer.parseInt(next());
	}
	public long nextLong(){
	    return Long.parseLong(next());
	}
	public double nextDouble(){
	    return Double.parseDouble(next());
	}
	int[] nextIntArray(int n) {
	    int[] arr = new int[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextInt();
	    }
	    return arr;
	}

	long[] nextLongArray(int n) {
	    long[] arr = new long[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextLong();
	    }
	    return arr;
	}
	public void close(){
	    try{ reader.close(); } catch(IOException e){e.printStackTrace();}
	}
    }
    static class FastWriter{
	BufferedWriter writer;
	public FastWriter(OutputStream stream){
	    writer = new BufferedWriter(new OutputStreamWriter(stream));
	}
	public void print(int i) {
	    print(Integer.toString(i));
	}
	public void println(int i) {
	    print(Integer.toString(i));
	    print('\n');
	}
	public void print(long i) {
	    print(Long.toString(i));
	}
	public void println(long i) {
	    print(Long.toString(i));
	    print('\n');
	}
	public void print(double i) {
	    print(Double.toString(i));
	}
	public void print(boolean i) {
	    print(Boolean.toString(i));
	}
	public void print(char i) {
	    try{writer.write(i);} catch(IOException e){e.printStackTrace();}
	}
	public void print(String s){
	    try{writer.write(s);} catch(IOException e){e.printStackTrace();}
	}
	public void println(String s){
	    try{writer.write(s);writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void println(){
	    try{writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void print(int arr[])
	{
	    for (int i = 0; i < arr.length; i++) {
		print(arr[i]);
		print(' ');
	    }
	}
	public void close(){
	    try{writer.close();} catch(IOException e){e.printStackTrace();}
	}
    }
}

import java.util.Scanner;
public class Test {
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		double a=sc.nextDouble();
		if(a>=0)
			for(int i=1;i<=16;i++){
			if(ismagic(a+i)){
				System.out.println(i);
				return;
			}
		}
		else if(a>-8){
			a=-a;
			System.out.println((int)(a+8));
		}
		else{
			a=-a;
			for(int i=1;i<=16;i++){
				if(ismagic(a-i)){
					System.out.println(i);
					return;
				}
			}
		}
	}
	public static boolean ismagic(double a){
		while(a!=0){
			if(a%10==8) return true;
			a=(int)a/10;
		}
		return false;
	}
}

/**
 * Created by Vlad Levochko on 21.11.2014.
 */
import java.io.*;
import java.util.*;

public class cf_a {
    public static void main(String args[]){
        Scanner in=null;
        PrintWriter out=null;
        try{
            in=new Scanner(System.in);
            out=new PrintWriter(System.out);
            long a=in.nextLong();
            boolean f=false;
            for (int i=1; i<=11; i++){
                a++;
                String s=Long.toString(a);
                for (int j=0; j<s.length(); j++)
                    if (s.charAt(j)=='8'){
                        out.println(i);
                        f=true;
                        break;
                    }
                if (f) break;
            }
        } catch (Exception e){

        } finally{
            in.close();
            out.close();
        }
    }
}

import java.util.Scanner;

public class main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input=new Scanner(System.in);
        int count=0,temp;
        String n;
        n=input.nextLine();
        if(n.contains("8"))
        {
            n=n.replaceAll("8","9");
            count++;
        }
        while(!n.contains("8"))
        {
            count++;
            temp=Integer.parseInt(n);
            temp++;
            n=""+temp;

        }
        System.out.println(count);

    }

}

import java.util.*;
import java.lang.*;
import java.io.*;
public class Sagar {
	public static void main (String[] args) {

		Scanner sc=new Scanner(System.in);

		String s=sc.nextLine();

		String z1=s;

		if(Integer.parseInt(s)<0) {
			System.out.println(1);
		}

		else if(s.contains("8")) {
			System.out.println(10);
		}
		else {

			int n=Integer.parseInt(s);

			int cnt=0;

			while(true) {

				n+=1;
				cnt++;
				String z=Integer.toString(n);
				if(z.contains("8")) {
					System.out.println(cnt);
					break;
				}

			}

		}

	}
}

import java.util.*;
import java.util.Collections;

public class GigaTower
{
	public static void main(String args[])
	{

		Scanner sc=new Scanner(System.in);

		int i,flag=0,count=0;
		long n;
		String s;

		n=sc.nextLong();
		s=Long.toString(n);
		int len=s.length();
		if(n>=80 && n<=88) {
			System.out.println(1);
			System.exit(0);
		}
		for(i=0;i<len;i++) {
			if(s.charAt(i)=='8')
				count++;
		}
		if(count>=1 && len>=3) {
			System.out.println(1);
		}
		else {
		if(n>=0) {
			char p=s.charAt(len-1);

			if(p<'8' && p>='0')
				System.out.println(8-Long.parseLong(String.valueOf(p)));
			if(p=='8')
				System.out.println(10);

			if(p=='9') {
				for(i=len-2;i>=0;i--) {
					if(s.charAt(i)=='9')
						continue;
					else if(s.charAt(i)=='7') {
							System.out.println(1);
							flag=1;
							break;
						}
					else {
						flag=1;
						System.out.println(9);
						break;
					}
					}
				if(flag==0)
					System.out.println(9);
				}
			}

		else {
			char m=s.charAt(len-1);
			if(len==2 && m>='1' && m<='7')
				System.out.println(8-(n));
			else {
				if(m=='0')
					System.out.println(2);
				if(m=='1')
					System.out.println(3);
				if(m=='2')
					System.out.println(4);
				if(m=='3')
					System.out.println(5);
				if(m=='4')
					System.out.println(6);
				if(m=='5')
					System.out.println(7);
				if(m=='6')
					System.out.println(8);
				if(m=='7')
					System.out.println(9);
				if(m=='8')
					System.out.println(10);
				if(m=='9')
					System.out.println(1);
			}

		}
		}

		sc.close();
	}
}

import java.util.*;
public class floor
{
public static void main(String args[])
{
Scanner e=new Scanner(System.in);
int n=e.nextInt();
int t=0,p=0,s=0;
while(t==0)
{
n++;
s++;
p=n;
while(p>0)
{
int r=p%10;
if(r==8)
{
t=1;
break;
}
p=p/10;
}
if(t==0)
{
}
}
System.out.println(s);
}
}

import java.util.Scanner ;

    public class Main {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    double a = input.nextDouble();
    int b = 0;
    a+=1;
    for( int i = 0 ; i < 10 ; i++){
      if(  isLuky(a) ){
       break ;

     }else{
     b++;
     a++;
   }
   }
   System.out.println(b+1);
    }
public static boolean isLuky(double n){
   boolean luck = false;
   if(n < 0){
    n = n * -1 ;
   }
   while (n != 0){
      int digit = ((int)(n)) % 10 ;
      n = n / 10 ;
     if(digit == 8){
      luck = true ;
     }
   }

return luck;
}
    }

import java.util.*;
import java.io.*;
import java.math.*;
//String.format("%.10f", new BigDecimal(ans))
public class Main {
    InputReader ir;
    void solve() {
        ir = new InputReader(System.in);
        int n = ir.readInt();
        //System.out.println(-259%10);
        for(int i = 1; i <= 10; i++) {
            if(check(n + i) == true) {
                System.out.println(i);
                return;
            }
        }

    }
    boolean check(int n) {
        while(n != 0) {
            int last = n %10;
            if(last == 8 || last == -8)
                return true;
            n /= 10;
        }
        return false;
    }
    public static void main(String[] args) {
        new Main().solve();
    }
}
class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }
        public final int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }
        public double readDouble() {
        return Double.parseDouble(readString());
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.*;
import java.util.*;

/**
 *
 * @author DELL
 */
public class Problem_A {

    public static void main(String[] args) throws IOException {
        BufferedReader x = new BufferedReader(new InputStreamReader(System.in));
        //1st line contating only 1 integer
        long n = Long.parseLong(x.readLine());

        String s = Long.toString(n);
        for (int i = 1; i <= 10; i++) {
            n++;
            s = Long.toString(n);
            if (s.contains("8")) {
                System.out.println(i);
                break;
            }
        }
    }
}

import java.util.Scanner;

public class Solution {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Integer a = in.nextInt();
		Integer minDiff = Integer.MAX_VALUE;
		if (a >= -8 && a <8) {
			System.out.println(8 - a);
			return;
		}

		if (a > 0) {
		int digit = 1;
		while ( a / digit > 0 && digit < 1000000000) {
			int diff = 8*digit - (a % (digit *10));
			if (diff <= 0) {
				diff += 10;
			}
			if (diff > 0 && diff < minDiff) {
				minDiff = diff;
			}
			digit *= 10;
		}
		} else {
			int digit = 1;
			while ( a / digit < 0 && digit < 1000000000) {
				int diff = -8*digit - (a % (digit *10));
				if (diff <= 0) {
					diff += 10;
				}
				if (diff > 0 && diff < minDiff) {
					minDiff = diff;
				}
				digit *= 10;
			}
		}
		System.out.println(minDiff);
	}
}

import java.util.*;
public class GigaTower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in  = new Scanner(System.in) ;

		long n =  in.nextLong() ;
		if(IStrue(n) == true ){
			System.out.println("0");

		}
		else{
		long temp = n ;
		while(IStrue(n) == false){
			n++ ;
		}
		System.out.println(n - temp);
		}

	}
	public static boolean IStrue(long n){
		String name  = Integer.toString((int) n) ;
		for(int i = 0 ; i<name.length() ; i++){
			if(name.charAt(i) == '8')
				return true ;

		}
		return false;

	}
}

import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Andrew Govorovsky ( AndrewG )
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {

    private boolean containsEight(long number) {
        while (number > 0) {
            if (number % 10 == 8) {
                return true;
            }
            number /=10;
        }
        return false;
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long n = in.readInt();

        for (int i = 1; i <= 10; i++) {
            if (containsEight(n + i)) {
                out.print(i);
                return;
            }
        }
    }
}

class InputReader {
    private BufferedReader bufferedReader;
    private StringTokenizer stringTokenizer;
    private static final String dlms = " \n\r\f\t";

    public InputReader(InputStream inputStream) {
        this.bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        this.stringTokenizer = new StringTokenizer("", dlms);
    }

    public String next() {
        while (!stringTokenizer.hasMoreTokens()) {
            try {
                stringTokenizer = new StringTokenizer(bufferedReader.readLine(), dlms);
            } catch (IOException e) {
                /* ignore */
            }
        }
        return stringTokenizer.nextToken();
    }

    public int readInt() {
        return Integer.parseInt(next());
    }

}

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.lang.Math;

public class project
{
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static int binarySearch(long a[],long k,int l,int h){
        int min = Integer.MAX_VALUE;
        while(l<=h){
         int mid = (l+h)/2;
         if(a[mid]==k) return mid;
         else if(a[mid]>k) h=mid-1;
         else if(a[mid]<k) l =mid+1;
    }

        return min;
    }

    static int gcd(int a, int b)
    {
        // Everything divides 0
        if (a == 0)
          return b;
        if (b == 0)
          return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        if (a > b)
            return gcd(a-b, b);
        return gcd(a, b-a);
    }

    public static void main(String[] args) throws Exception
    {

        FastReader sc = new FastReader();
        int i,j=0;

        int n = sc.nextInt();
        int t=n;
        int d=0;
        int r;
        if(n<0) {t=0; d=Math.abs(n);}

        if(t%10<8){
            d += 8 - (t%10);
        }
        else if(t%10==8){
            d+=10;
        }
        else if(t%10>8){

            if(((t/10)%10) == 7) {d=1; }
            else d=8;
        }

        System.out.print(d);

}

}

// System.out.println();

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if (n < 0) {
			System.out.println(-n + 8);
		} else {
			int c1 = 0;
			for (long i = n+1; i >= 0; i++) {
				String str = "" + i;
				c1++;
				if (str.indexOf('8') != -1) {
					break;
				}
			}
			System.out.println(c1);
		}

	}
}

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
	 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int ans = 0;
		if (n < 0) {
			ans += -n;
			System.out.println(ans + 8);
		} else {
			for (int i = n; i < n + 10; i++) {

				if (String.valueOf(i).contains("8")) {
					System.out.println(ans);
					break;
				}
				ans++;
			}
		}

	}

}

import java.util.*;
public class A {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		for(int i = 1; i <= 10; i++) {
			if(check(x + i)) {
				System.out.println(i); return;
			}
		}
	}
	static boolean check(long x) {
		while(x > 0) {
			if(x % 10 == 8) return true;
			x /= 10;
		}
		return false;
	}

}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        long t = b ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h && r == 9 )
        {
            t /= 10 ;
            while ( t % 10 == 9 && t > 0 )
            {
                t /= 10 ;
            }
            if ( t % 10  == 8 )
                System.out.println(9);
            else
                System.out.println(1);
        }
        else if ( h && t < 0 && r == 0 )
        {
            t /= 10 ;
            t *= -1 ;
            while ( t % 10 == 0 && t > 0 )
            {
                t /= 10 ;
            }
            if ( t % 10  == 8 )
                System.out.println(2);
            else
                System.out.println(1);
        }
        else if ( h )
            System.out.println(1);
        else if ( (t/10)%10 == 7 && r == 9 )
            System.out.println( 1 );
        else if ( r > 7 && t > 0 )
            System.out.println(18 - r );
        else if ( t >= 0 )
            System.out.println(Math.abs(r - 8));
        else if ( r == -9 )
            System.out.println( 1 );
        else if ( r == 0 )
            System.out.println( 2 );
        else
            System.out.println( 8 - r );
    }

}

import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
}

class TaskA {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int res = 1;
        for(int i = n+1; !check(i); ++i) ++res;
        out.println(res);
    }

    boolean check(int number){
        int digit;
        while(number > 0){
            digit = number%10;
            number/=10;
            if(digit == 8) return true;
        }
        return false;
    }
}

class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt(){
        return Integer.parseInt(next());
    }

}

import java.util.Scanner;

public class TestRun {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long cf = sc.nextLong();

        String check8=String.valueOf(cf);
        char[] check=check8.toCharArray();
        for(char i:check){
            if(i=='8'){
                System.out.println("1");
                System.exit(0);
            }
        }

        if (cf >= 0) {
            int r = (int) (cf % 10);

            int r7h = (int) (cf % 100);
            int r7 = r7h / 10;
            if (r7 == 7) {
                if (r == 9) {
                    System.out.println("1");
                }
                System.exit(0);
            }

            switch (r) {
                case 0:
                    System.out.println("8");
                    break;
                case 1:
                    System.out.println("7");
                    break;
                case 2:
                    System.out.println("6");
                    break;
                case 3:
                    System.out.println("5");
                    break;
                case 4:
                    System.out.println("4");
                    break;
                case 5:
                    System.out.println("3");
                    break;
                case 6:
                    System.out.println("2");
                    break;
                case 7:
                    System.out.println("1");
                    break;
                case 8:
                    System.out.println("10");
                    break;
                case 9:
                    System.out.println("9");
                    break;

            }

        }
        else{
            int r = (int) (cf % 10);

            int r7h = (int) (cf % 100);
            int r7 = r7h / 10;
            if (r7 == -7) {
                if (r == -9) {
                    System.out.println("9");
                }
                System.exit(0);
            }

            switch (r) {
                case 0:
                    System.out.println("2");
                    break;
                case -1:
                    System.out.println("3");
                    break;
                case -2:
                    System.out.println("4");
                    break;
                case -3:
                    System.out.println("5");
                    break;
                case -4:
                    System.out.println("6");
                    break;
                case -5:
                    System.out.println("7");
                    break;
                case -6:
                    System.out.println("8");
                    break;
                case -7:
                    System.out.println("9");
                    break;
                case -8:
                    System.out.println("10");
                    break;
                case -9:
                    System.out.println("1");
                    break;

            }
        }
    }
}

import java.util.Scanner;

public class Giga_Tower {

	private static boolean isLucky(int i) {
		String number = i + "";
		int len = number.length();
		int count = 0;
		for (int j = 0; j < number.length(); j++) {
			if ((number.charAt(j) == '8')) {
				return true;
			}
		}

		return false;
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scn = new Scanner(System.in);

		int number;
		number=scn.nextInt();
		int count=1;

		number+=1;
		while((!isLucky(number)) || (number<=0)){
			number+=8;
			count++;
		}

		System.out.println(count);
	}

}

import java.util.Arrays;

import java.util.HashSet;
import java.util.*;
import java.util.Scanner;

public class a_supercentral_point {
	public static int gcd(int a, int b) {
		while (a % b != 0) {
			int c = a % b;
			a = b;
			b = c;

		}
		return b;
	}

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();

		for (int i = 1; i <= 10; i++) {
			int temp = n + i;
			String s = temp + "";
			if (s.contains("8")) {
				System.out.println(i);
				return;
			}

		}

	}
}

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Main {

	InputStream is;
	PrintWriter out;
	String INPUT = "";

	private static final long M = 1000000007L;

	void solve() {
		StringBuffer sb = new StringBuffer();
		long N = ni();
		for (int ans = 1; ans <= 12; ans++) {
			if (isLucky(N + ans)) {
				out.println(ans);
				break;
			}
		}
	}

	private boolean isLucky(long l) {
		l = Math.abs(l);
		while (l > 0) {
			if (l % 10 == 8)
				return true;
			l /= 10;
		}
		return false;
	}

	private long gcd(long a, long b) {
		while (a != 0) {
			long tmp = b % a;
			b = a;
			a = tmp;
		}
		return b;
	}

	void run() throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		if (!INPUT.isEmpty())
			tr(System.currentTimeMillis() - s + "ms");
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	private byte[] inbuf = new byte[1024];
	public int lenbuf = 0, ptrbuf = 0;

	private int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}

	private double nd() {
		return Double.parseDouble(ns());
	}

	private char nc() {
		return (char) skip();
	}

	private String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != '
									// ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n) {
			if (!(isSpaceChar(b)))
				buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}

	private int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private Integer[] na2(int n) {
		Integer[] a = new Integer[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private Integer[][] na(int n, int m) {
		Integer[][] a = new Integer[n][];
		for (int i = 0; i < n; i++)
			a[i] = na2(m);
		return a;
	}

	private int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private static void tr(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
}

import java.util.*;
import java.lang.*;
import java.io.*;
public class Sagar {
	public static void main (String[] args) {

		Scanner sc=new Scanner(System.in);

		String s=sc.nextLine();

		String z1=s;

		if(Integer.parseInt(s)<0) {
			System.out.println(1);
		}

		else if(s.contains("8")) {
			System.out.println(10);
		}
		else {

			int n=Integer.parseInt(s);

			int cnt=0;

			while(true) {

				n+=1;
				cnt++;
				String z=Integer.toString(n);
				if(z.contains("8")) {
					System.out.println(cnt);
					break;
				}

			}

		}

	}
}

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class D {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        long l = Long.parseLong(bf.readLine());
        for(int i=1; i<=10; i++) {
            l++;
            String s = l+"";
            if(s.indexOf('8') != -1) {
                System.out.println(i);
                System.exit(0);
            }
        }
        // Scanner scan = new Scanner(System.in);
        // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        // StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        // int n = Integer.parseInt(st.nextToken());
        // int n = scan.nextInt();

        // out.close(); System.exit(0);
    }
}

import java.util.*;
import java.math.*;
import java.lang.*;
public class main{

  public static void main(String[] args) {
           Scanner cin = new Scanner(System.in);
      String str=cin.nextLine();
        System.out.println(b(str));
      }

      public static int b(String str){
               boolean nines=true,neg=false;
               if (str.charAt(0)=='-')neg=true;
              if(!neg){
                int i=0,x=-1;
                for (int j = str.length()-1 ; j>=0 ;--j){

                  if (str.charAt(j)=='9'&&nines)i++;

                  else {
                    nines=false;
                    if (str.charAt(j)=='8')x=str.length()-(j+1);
                  }
                }
        if(str.charAt(str.length()-(i+1))=='7'||(x!=-1&&x!=i))return 1;
        if (str.charAt(str.length()-1)<'8')return (int)('8'-str.charAt(str.length()-1));
        if (str.charAt(str.length()-1)=='9')return 9;
        if (str.charAt(str.length()-1)==8&&str.charAt(str.length()-2)==7)return 2;
         return 10;
       }
       else {
         int i=0,x=-1;
         for (int j = str.length()-1 ; j>=0 ;--j){

           if (str.charAt(j)=='0'&&nines)i++;

           else {
             nines=false;
             if (str.charAt(j)=='8')x=str.length()-(j+1);
           }
         }
         if (str.charAt(str.length()-2)=='9'&&str.charAt(str.length()-1)<'4')return ((int)str.charAt(str.length()-1)-'0')+1;
 if(str.charAt(str.length()-(i+1))=='9'||(x!=-1&&x!=i))return 1;
         if (str.length()==2&&str.charAt(1)<'9')return ((int)(str.charAt(1)+'8')-(2*'0'));
         if(str.charAt(str.length()-(i+1))=='9')return 1;
         if (str.charAt(str.length()-1)<'8')return (int)((str.charAt(str.length()-1)-'8')+10);
         if (str.charAt(str.length()-1)=='9')return 1;
          return 10;
       }
      }

  }

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author neuivn
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a = in.nextInt();

            int bb = 0;

            for (int low = 1; low <= 10; ++low) {
                if (isLucky(a + low)) {
                    bb = low;
                    break;
                }
            }
            out.println(bb);
        }

        private boolean isLucky(int p) {
            p = Math.abs(p);
            while (p > 0) {
                if (p % 10 == 8) return true;
                p /= 10;
            }
            return false;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}

import java.util.Scanner;

public class CFGiga {

    public static boolean has8(long a) {
        if (a < 0) {
            return has8(-a);
        } else if (a == 0) {
            return false;
        } else {
            long last = (a % 10);
            if (last == 8) {
                return true;
            } else {
                return has8(a / 10);
            }
        }
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long a = input.nextLong();
        for (long i = 1; i <= 10; i++) {
            if (has8(a+i)) {
                System.out.println(i);
                break;
            }
        }
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class codeforces {
	static PrintWriter out;
	public static void main(String[] args) {
		FS scan = new FS(System.in);
		int N = scan.nextInt();
		for(int i=N+1;i<=N+10;i++){
			boolean contains = false;
			int t = Math.abs(i);
			while(t!=0){
				if(t%10==8)contains=true;
				t/=10;
			}
			if(contains){
				System.out.println(i-N);
				return;
			}
		}
	}

	private static class FS {
		BufferedReader br;
		StringTokenizer st;
		public FS(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		String next(){
			while(st==null||!st.hasMoreElements()){
				try{st = new StringTokenizer(br.readLine());}
				catch(IOException e){e.printStackTrace();}
			}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());}
		double nextDouble() { return Double.parseDouble(next());}
	}
}

import java.util.Arrays;
import java.util.Scanner;
import java.util.Vector;

public class A {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long i=1;
		String s="8888888888";
		while(true) {
			String s1=Long.toString(n+i);
			if(s1.compareTo(s)>0)
				break;
			if(s1.indexOf('8')!=-1) {
				break;
			}
			i++;

		}

	System.out.println(i);
	}
}

import java.util.Scanner;

public class ProblemA {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

	}

}

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class sobel {
	public static boolean check(String s){
		for (int i = 0 ;i < s.length() ; i++){
			if (s.charAt(i) == '8')
				return true;
		}
		return false;
	}
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long  n;
		n = in.nextLong();

		int h = 0;
		while (!check(String.valueOf(n+h))) {
			h++;
		}
		System.out.print(h);
		in.close();
	}

}

import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num =sc.nextInt();
sc.close();
int temp = num;
do{
	temp++;

}while(noEight(temp));
int pDiff = Math.abs(num - temp);
System.out.println(pDiff);
}
static boolean noEight(int num){
	while(num>0)
	{
		if(num%10==8)
			return false;
		num = num/10;
	}
	return true;
}
}

import java.io.*;
import java.util.*;

public class GigaTower {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i)=='8') {
                System.out.println("0");
                return;
            }}
            int n = Integer.parseInt(s);
            if (n<10) {
                System.out.println(Math.abs(8-n));
                return ;
        }
         System.out.println(Math.min(2+n%10,Math.abs(8-n%10)));

    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by kaaveh on 12/25/14.
 */
public class _488A_ {   //I hope enjoy! :)

    public static void main(String[] args) throws IOException {

        Reader in= null;
        in.init(System.in);
        long n,b;
        String temp;
        boolean go=true;
        n=Math.abs(in.nextInt());
        b=Math.abs(n+1);

        while(go){
            temp= String .valueOf(b);
            for(int i=0; i<temp.length(); i++){
                if(temp.charAt(i) == '8'){
                    go=false;
                    b--;
                    break;
                }
            }
            b++;
        }
        System.out.println(b-n);
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }

    static String  nextLine() throws IOException {
        return reader.readLine();
    }

}

import java.util.Scanner;

public class M {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        float a = scan.nextFloat();
        int c = 0;
        while(true){
            a++;c++;
            String s = String.valueOf(a);
            if(s.contains("8")){
                break;
            }
        }
        System.out.println(c);
        scan.close();
    }

}

import java.util.Scanner;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        Integer a = in.nextInt();
        Integer minDiff = Integer.MAX_VALUE;
        if (a >= -8 && a <8) {
            System.out.println(8 - a);
            return;
        }

        if (a > 0) {
        int digit = 1;
        while ( a / digit > 0) {
            int diff = 8*digit - (a % (digit *10));
            if (diff <= 0) {
                diff += 10;
            }
            if (diff > 0 && diff < minDiff) {
                minDiff = diff;
            }
            digit *= 10;
        }
        } else {
            int digit = 1;
            while ( a / digit < 0) {
                int diff = -8*digit - (a % (digit *10));
                if (diff <= 0) {
                    diff += 10;
                }
                if (diff > 0 && diff < minDiff) {
                    minDiff = diff;
                }
                digit *= 10;
            }
        }
        System.out.println(minDiff);
    }
}

//package aa;

import java.util.Scanner;

public class map {
    static Scanner in=new Scanner(System.in);
    public static void main(String[] args) {
    int x;
    x=in.nextInt();
    int z=0;
    boolean z1=false;

    for(int i=x+1;i<1000000000;i++)
    {
    z=i;
    String y="";
    y=y+i;
    //System.out.println(y);
    for(int j=0;j<y.length();j++){
    if(y.charAt(j)=='8'){
        z1=true;
        break;
    }

    }
    if(z1==true){break;}
    }
        System.out.println(z-x);

    }
    }

import java.util.*;
import java.io.*;
public class GigaTower
{
    public static void main(String []args) throws IOException {
	FastScanner in  = new FastScanner(System.in);
	FastWriter  out = new FastWriter(System.out);
	solve(in, out);
	in.close();
	out.close();
    }
    private static boolean isLucky(long n)
    {
	while(n>0)
	{
	    if(n%10 == 8)
		return true;

	    n /= 10;
	}
	return false;
    }
    private static void solve(FastScanner s1, FastWriter out)/* This is the actual solution */{

	long n = s1.nextLong();
	if(n>=0)
	{
	if((n%10) < 8)
	{
	    out.print(8-(n%10));
	}
	else
	{
	    long rest = (n/10) + 1;
	    long new_n;
	    if(isLucky(rest))
		new_n = (rest*10);
	    else
		new_n = (rest*10)+8;

	    out.print((new_n-n));
	}
	}
	else
	{
	    n = -n;
	    if(n<=8)
	    {
		out.print(n+8);
	    }
	    else if(n%10 == 9)
		out.print("1");
	    else
	    {
		long rest = n/10;
		if(isLucky(rest) && (n%10 != 0))
		    out.print("1");
		else
		{
		    rest = (n/10) - 1;
		    if(isLucky(rest))
			out.print((n%10)+1);
		    else
		    {
			out.print((n%10)+2);  //(10+MOD)-8
 		    }
		}
	    }
	}

    }

    static class FastScanner{
	public BufferedReader reader;
	public StringTokenizer st;
	public FastScanner(InputStream stream){
	    reader = new BufferedReader(new InputStreamReader(stream));
	    st = null;
	}
	public String next(){
	    while(st == null || !st.hasMoreTokens()){
		try{
		    String line = reader.readLine();
		    if(line == null) return null;
		    st = new StringTokenizer(line);
		}catch (Exception e){
		    throw (new RuntimeException());
		}
	    }
	    return st.nextToken();
	}
	public String nextLine(){
            String str = null;
            try {
                str = reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
	public int nextInt(){
	    return Integer.parseInt(next());
	}
	public long nextLong(){
	    return Long.parseLong(next());
	}
	public double nextDouble(){
	    return Double.parseDouble(next());
	}
	int[] nextIntArray(int n) {
	    int[] arr = new int[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextInt();
	    }
	    return arr;
	}

	long[] nextLongArray(int n) {
	    long[] arr = new long[n];
	    for (int i = 0; i < n; i++) {
		arr[i] = nextLong();
	    }
	    return arr;
	}
	public void close(){
	    try{ reader.close(); } catch(IOException e){e.printStackTrace();}
	}
    }
    static class FastWriter{
	BufferedWriter writer;
	public FastWriter(OutputStream stream){
	    writer = new BufferedWriter(new OutputStreamWriter(stream));
	}
	public void print(int i) {
	    print(Integer.toString(i));
	}
	public void println(int i) {
	    print(Integer.toString(i));
	    print('\n');
	}
	public void print(long i) {
	    print(Long.toString(i));
	}
	public void println(long i) {
	    print(Long.toString(i));
	    print('\n');
	}
	public void print(double i) {
	    print(Double.toString(i));
	}
	public void print(boolean i) {
	    print(Boolean.toString(i));
	}
	public void print(char i) {
	    try{writer.write(i);} catch(IOException e){e.printStackTrace();}
	}
	public void print(String s){
	    try{writer.write(s);} catch(IOException e){e.printStackTrace();}
	}
	public void println(String s){
	    try{writer.write(s);writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void println(){
	    try{writer.write('\n');} catch(IOException e){e.printStackTrace();}
	}
	public void print(int arr[])
	{
	    for (int i = 0; i < arr.length; i++) {
		print(arr[i]);
		print(' ');
	    }
	}
	public void close(){
	    try{writer.close();} catch(IOException e){e.printStackTrace();}
	}
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        long t = b ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h && r == 9 )
        {
            t /= 10 ;
            while ( t % 10 == 9 && t > 0 )
            {
                t /= 10 ;
            }
            if ( t % 10  == 8 )
                System.out.println(9);
            else
                System.out.println(1);
        }
        else if ( h )
            System.out.println(1);
        else if ( (t/10)%10 == 7 && r == 9 )
            System.out.println( 1 );
        else if ( r > 7 && t > 0 )
            System.out.println(18 - r );
        else if ( t >= 0 )
            System.out.println(Math.abs(r - 8));
        else if ( r == -9 )
            System.out.println( 1 );
        else if ( r == 0 )
            System.out.println( 2 );
        else
            System.out.println( 8 - r );
    }

}

import java.util.Scanner;
import java.io.PrintWriter;
import java.util.Arrays;

public class Smile {
	static Scanner in;
	static PrintWriter out;

	static boolean eight(int num) {
		while (num > 0) {
			if (Math.abs(num % 10) == 8) {
				return true;
			}
			num /= 10;
		}
		return false;
	}

	public static void main(String[] args) {
		in = new Scanner(System.in);
		out = new PrintWriter(System.out);
		boolean flag = false;
		int n = in.nextInt();
		int a = n;
		for (int i = 1; i <= 10; i++) {
			a += 1;
			flag = eight(a);
			if (flag) {
				out.println(a - n);
				out.close();
				return;
			}

		}

		out.close();
	}
}

import java.util.*;

public class helloWorld
{
	public static void main(String[] args)
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int ans = 1;
		for(; true; ans++) {
			int a = n+ans;
			for(; a > 0; a /= 10)
				if(a % 10 == 8)
					break;
			if(a > 0)
				break;
		}

		System.out.print(ans);

		in.close();
	}
}

//package contest;

import java.util.Scanner;

public class LUCKY {
    static Scanner in=new Scanner(System.in);
    public static void main(String[] args) {
    int x;
    x=in.nextInt();

    int z=0;
    boolean z1=false;

    int z2=0;
    boolean z3=false;
    for(int i=x+1;i<888888888;i++)
    {
    z++;
    String y="";
    y=y+i;
    //System.out.println(y);
    for(int j=0;j<y.length();j++){
    if(y.charAt(j)=='8'){
        z1=true;
        break;
    }

    }
    if(z1==true){break;}
    }

    for(int i=x-1;i>0 ;i--)
    {
    z2++;

    String y="";
    y=y+i;
    //System.out.println(y);
    for(int j=0;j<y.length();j++){
    if(y.charAt(j)=='8'){
        z3=true;
        break;
    }

    }
    if(z3==true){break;}
    }
        int min=Math.min(z,z2);
     if(x<=0){       System.out.println(z);}
     else{ System.out.println(min);}

    }

    }

import java.util.*;
import java.io.*;
import java.math.*;

public class main {
    public static void main(String[] args) throws Exception {
        Reader in = new Reader(System.in);
        Writer out = new Writer(System.out);
        Task task = new Task(in, out);
        task.solve();
        in.close();
        out.close();
    }
}

class Task {
    public void solve() {
        int x = in.nextInt();
        int ans = 0;
        if (x < 0) {
            ans -= x;
            x = 0;
        }
        if (check(x)) {
            x++; ans++;
        }
        while (!check(x)) {
            ans++;
            x++;
        }
        out.println(ans);
    }
    boolean check(int x) {
        while (x != 0) {
            if (x % 10 == 8)
                return true;
            x /= 10;
        }
        return false;
    }
    private Reader in;
    private Writer out;
    public Task(Reader input, Writer output) {
        in = input;
        out = output;
    }
}

class Reader {
    BufferedReader reader;
    StringTokenizer str;
    Reader(String filename) throws Exception {
        reader = new BufferedReader(new FileReader(filename));
    }
    Reader(InputStream input) throws Exception {
        reader = new BufferedReader(new InputStreamReader(input));
    }
    public String next() {
        while (str == null || str.hasMoreTokens() == false) {
            try {
                str = new StringTokenizer(reader.readLine());
            }
            catch (Exception ex) {
                throw new InputMismatchException();
            }
        }
        return str.nextToken();
    }
    public long nextLong() {
        return Long.parseLong(next());
    }
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
        return Double.parseDouble(next());
    }
    public void close() throws Exception {
        reader.close();
    }
}

class Writer extends PrintWriter {
    public Writer(OutputStream output) {
        super (output);
    }
    public Writer(String filename) throws Exception {
        super(new File(filename));
    }
    public void print(Object...objects) {
        for (int i = 0; i < objects.length; i++) {
            this.print(objects[i]);
            this.print(" ");
        }
        this.println();
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
// package giga.tower;

import java.util.Scanner;

/**
 *
 * @author Mostafa
 */
public class GigaTower {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner (System.in);
        long b = in.nextLong();
        byte r = (byte) (b % 10) ;
        long t = b ;
        b = Math.abs(b) / 10 ;
        boolean h = false ;
        while ( b > 0 )
        {
            if ( b % 10 == 8 )
            {
                h = true ;
                break ;
            }
            b /= 10 ;
        }
        if ( h && ( r != 9 && t/10 != 8 ) )
            System.out.println(1);
        else if ( t/10 == 8  )
            System.out.println( 10 - r );
        else if ( r > 7 && t > 0 )
            System.out.println(18 - r );
        else if ( t > 0 )
            System.out.println(Math.abs(r - 8));
        else if ( r == 9 )
            System.out.println(1);
        else
            System.out.println( r + 8 );
    }

}

import java.util.Scanner;
public class NewClass
{
    public static void main(String[] args)
    {
      long current , initial1=0 , initial2=0 , count=0 , temp=0 ;
      String str="";
      Scanner input = new Scanner(System.in);
      current = input.nextLong();
      temp=current;
      while(temp > 0)
      {
          if(temp % 10 == 8)
          {
              initial1++;
          }
          temp -= temp%10;
          temp /= 10;
      }
      initial2 = initial1;

      while(true)
      {
          if(current <= 0)
          {
              count+= 8 - current;
              break;
          }

          else
          {
              current++;
              temp=current;
              initial1=0;
              while(temp > 0)
                {

                    if(temp % 10 == 8)
                    {
                        initial1++;
                    }
                    temp -= temp%10;
                    temp /= 10;
                }
                count++;

          }

          if(initial1 > 0)
            break;
      }

      System.out.println(count);
    }
}

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

//package Java_8;

import java.util.Scanner;

/**
 *
 * @author Tarango Khan
 */
public class Main {
    public static void main(String[] args) {
        Scanner kb = new Scanner(System.in);
        int num = kb.nextInt();
        num++;
        int total = 1;
        int flag = 0;
        while(true){
            int n = num%10;
            if(n<8){
                total += (8-n);
                break;
            }
            String s  = Integer.toString(num);
            for(int i = 0;i<s.length();i++){
                if(s.charAt(i) == '8'){
                    flag = 1;
                    break;
                }
            }
            if(flag == 1) break;
            total++;num++;
        }
        System.out.println(total);
    }
}

import java.util.Scanner;

public class Solution {

    public static void main(String[] args) throws Exception{
        Scanner in = new Scanner(System.in);

        int a = in.nextInt();
        int c = 0;
        for(int i = 0; i <= 10; i++){
            if(c == 0 && has(a)){
                c++;
                continue;
            }else if(has(a + i)){
                System.out.println(c);
                break;
            }else{
                c++;
            }
        }

        in.close();
    }

    public static boolean has(int a){
        while(a > 0){
            int r = a%10;
            a/=10;
            if(r == 8){
                return true;
            }
        }
        return false;
    }
}

import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;
            do {
                if(c<'0'||c>'9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }

    static void merge(int arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2){
            if (L[i] <= R[j]){
                arr[k] = L[i];
                i++;
            }
            else{
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1){
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sort(int arr[], int l, int r) {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }

    static void mergel(long arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        long L[] = new long [n1];
        long R[] = new long [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2){
            if (L[i] <= R[j]){
                arr[k] = L[i];
                i++;
            }
            else{
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1){
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sortl(long arr[], int l, int r) {
        if (l < r)
        {
            int m = (l+r)/2;
            sortl(arr, l, m);
            sortl(arr , m+1, r);
            mergel(arr, l, m, r);
        }
    }

    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long a=in.nextLong(),num=a;
        for(a++;;a++){
            long n=a;
            for(;n>0;){
                if(n%10==8){
                    out.println(a-num);
                    break;
                }
                n/=10;
            }
            if(n!=0)
                break;
        }

        out.close();
    }
}

import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class D {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        long l = Long.parseLong(bf.readLine());
        for(int i=1; i<=10; i++) {
            l++;
            String s = l+"";
            if(s.indexOf('8') != -1) {
                System.out.println(i);
                System.exit(0);
            }
        }
        // Scanner scan = new Scanner(System.in);
        // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        // StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        // int n = Integer.parseInt(st.nextToken());
        // int n = scan.nextInt();

        // out.close(); System.exit(0);
    }
}

import java.util.Scanner;
public class Watermelon {
	public static void main(String[] args) {
	    Scanner sc=new Scanner(System.in);
        Integer n=sc.nextInt();
        int f=0;
        int b=0;
        int flag=0;
        char[] carr;
        while(f!=1){
        	flag=0;
        	n++;
        	carr=n.toString().toCharArray();
        //	display(carr);
        	//System.out.println(b);
        	for(int i=0;i<carr.length;i++){
        		if(carr[i]!='8'){
        		flag=0;
        		}
        		else{
        			flag=1;
                     f=1;
        		 }
        	}
        	if(flag==0)
        		b++;
        }
        System.out.println(b);
        sc.close();
	}
	 static void display(char[] arr){
			for(int i=0;i<arr.length;i++){
				System.out.print(arr[i]+" ");
			}
			System.out.println();
		  }
	 static void display(String[] arr){
			for(int i=0;i<arr.length;i++){
				System.out.print(arr[i]+" ");
			}
			System.out.println();

		  }
	 static void display(Integer[] arr){
			for(int i=0;i<arr.length;i++){
				System.out.print(arr[i]+" ");
			}
			System.out.println();

		  }
	 static void display(int[] arr){
			for(int i=0;i<arr.length;i++){
				System.out.print(arr[i]+" ");
			}
			System.out.println();

		  }
	 static String str(char[] carr){
		 String str="";
		 for(int i=0;i<carr.length;i++){
			    str=str+carr[i];
			}
		 return str;
	 }

	}

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class A {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		if (n < 0) {
			System.out.println(-n + 8);
		} else {
			int c1 = 0;
			for (long i = n+1; i >= 0; i++) {
				String str = "" + i;
				c1++;
				if (str.indexOf('8') != -1) {
					break;
				}
			}
			System.out.println(c1);
		}

	}
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * Created by kaaveh on 12/25/14.
 */
public class _488A_ {   //I hope enjoy! :)

    public static void main(String[] args) throws IOException {

        Reader in= null;
        in.init(System.in);
        long n,b;
        String temp;
        boolean go=true;
        n=in.nextInt();
        b=n+1;

        while(go){
            temp= String .valueOf(b);
            for(int i=0; i<temp.length(); i++){
                if(temp.charAt(i) == '8'){
                    go=false;
                    b--;
                }
            }
            b++;
        }
        System.out.println(b-n);
    }
}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            tokenizer = new StringTokenizer(
                    reader.readLine() );
        }
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt( next() );
    }

    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }

    static String  nextLine() throws IOException {
        return reader.readLine();
    }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Stack;
import java.util.TreeMap;

public class Main {

    public static boolean contains8 (long a) {
        while (a > 0) {
            if (a % 10 == 8) return true;
            a /= 10;
        }
        return false;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        long a = Long.parseLong(line);
        for (int i = 1; i < 21; i++) {
            a++;
            if (contains8(a)) {
                System.out.println(i);
                return;
            }
        }

    }
}

import java.util.*;
import java.io.*;
import java.math.*;
//String.format("%.10f", new BigDecimal(ans))
public class Main {
    InputReader ir;
    void solve() {
        ir = new InputReader(System.in);
        int n = ir.readInt();
        System.out.println(-259%10);
        for(int i = 1; i <= 10; i++) {
            if(check(n + i) == true) {
                System.out.println(i);
                return;
            }
        }

    }
    boolean check(int n) {
        while(n != 0) {
            int last = n %10;
            if(last == 8 || last == -8)
                return true;
            n /= 10;
        }
        return false;
    }
    public static void main(String[] args) {
        new Main().solve();
    }
}
class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1)
            throw new InputMismatchException();
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0)
                return -1;
        }
        return buf[curChar++];
    }
        public final int readInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    public long readLong() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        long res = 0;
        do {
            if (c < '0' || c > '9')
                throw new InputMismatchException();
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return isWhitespace(c);
    }
        public double readDouble() {
        return Double.parseDouble(readString());
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {
        public boolean isSpaceChar(int ch);
    }
}

import java.util.Scanner;

public class Giga_Tower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scan = new Scanner(System.in);
		Long f = scan.nextLong();
		Long ff = f;
		for (;; ff++) {
			if (ff.toString().contains("8")) {
				System.out.print(ff - f);
				break;
			}
		}
		scan.close();
	}
}

public class GigaTower {
	public static void main(String[] args) {
		java.util.Scanner scanner = new java.util.Scanner(System.in);
		long n = scanner.nextLong();
		int count = 0;
		boolean flag = false;
		while (!flag) {
			n++;
			count++;
			long m = n;
			while (m > 0) {
				long digit = m % 10;
				if (digit == 8) {
					flag = true;
					break;
				} else {
					m = m / 10;
				}
			}
		}
		System.out.println(count);
	}
}

import java.io.*;
import java.util.*;

public class Main {

    public static StringTokenizer tokenizer;
    public static BufferedReader reader;
    public static PrintWriter writer;

    public static void init() {
//        try {
        reader = new BufferedReader(new InputStreamReader(System.in));
        writer = new PrintWriter(new OutputStreamWriter(System.out));
//            reader = new BufferedReader(new InputStreamReader(new FileInputStream("notation.in")));
//            writer = new PrintWriter(new OutputStreamWriter(new FileOutputStream("notation.out")));
//        } catch (IOException e) {
//            System.out.println(e);
//            System.exit(1);
//        }
    }

    public static String nextToken() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                System.out.println(e);
                System.exit(1);
            }
        }
        return tokenizer.nextToken();
    }

    public static int nextInt() {
        return Integer.parseInt(nextToken());
    }

    public static long nextLong() {
        return Long.parseLong(nextToken());
    }

    public static byte nextByte() {
        return Byte.parseByte(nextToken());
    }

    public static double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    public static float nextFloat() {
        return Float.parseFloat(nextToken());
    }

    public static short nextShort() {
        return Short.parseShort(nextToken());
    }

    public static void close() {
        try {
            reader.close();
            writer.flush();
            writer.close();
        } catch (IOException e) {
            System.out.println(e);
            System.exit(1);
        }
    }

    public static void main(String[] args) {
        init();
        solve();
        close();
    }

    public static void solve() {
        long a = nextLong();
        if (a <= 0) {
            writer.print(Math.abs(a)+8);
        } else {
            long cnt = 0;
            String temp = String.valueOf(a);
            String temp1 = temp.replace("8"," ");
            do {
                a++;
                temp = String.valueOf(a);
                temp1 = temp.replace("8"," ");

                cnt++;
            } while (temp.equals(temp1));
            writer.print(cnt);
        }
    }
}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import static java.lang.Integer.parseInt;

public class GigaTower {

    static BufferedReader b;
    static PrintWriter out;

    public static void main(String args[]) throws IOException {
        b = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        int n = parseInt(b.readLine());
        int ans = 1 ,t,x, flag =0;

        while (true) {
          n++;
          t = n;

          while(t > 0){
              x = Math.abs(t)%10;
              if(x == 8){
                  flag = 1 ;
                  break;
              }
              t = t/10;
          }

          if(flag == 1){
           out.println(ans);
           break;
          }
          else
              ans++;
        }
        out.flush();
    }

}

import java.util.*;
public class GigaTower {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in  = new Scanner(System.in) ;
		long n =  in.nextLong() ;
		long temp = n ;
		while(IStrue(n) == false){
			n++ ;
		}
		System.out.println(n - temp);

	}
	public static boolean IStrue(long n){
		String name  = Integer.toString((int) n) ;
		for(int i = 0 ; i<name.length() ; i++){
			if(name.charAt(i) == '8')
				return true ;

		}
		return false;

	}
}

import java.util.Scanner;

public class main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input=new Scanner(System.in);
        int count=0,temp;
        String n;
        n=input.nextLine();
        if(n.contains("8")&&n.length()>1)
        {
            n=n.replaceFirst("8","9");
            count++;
        }
        //System.out.println(n);
        while(!n.contains("8"))
        {
            count++;
            temp=Integer.parseInt(n);
            temp++;
            n=""+temp;

        }
        System.out.println(count);

    }

}