#include <bits/stdc++.h>
using namespace std;
bool Lucky(int x) {
  int i = 0;
  string S;
  bool Lucky = false;
  ostringstream convert;
  convert << x;
  S = convert.str();
  while (!Lucky && i < S.length())
    if (S[i] == '8')
      Lucky = true;
    else
      i++;
  return Lucky;
}
int main() {
  int N, i = 1;
  cin >> N;
  while (!Lucky(N + i)) i++;
  cout << i << endl;
  return 0;
}
