#include <bits/stdc++.h>
using namespace std;
int mod(int n) {
  if (n < 0) return -n;
  return n;
}
bool isLucky(long long int n) {
  n = mod(n);
  while (n > 0) {
    if (n % 10 == 8) return true;
    n /= 10;
  }
  return false;
}
int main() {
  long long int n, k = 0, i;
  cin >> n;
  if (isLucky(n)) k++;
  while (!isLucky(n + k)) k++;
  cout << k;
  return 0;
}
