#include <bits/stdc++.h>
using namespace std;
bool OK(long long k) {
  k = abs(k);
  while (k != 0) {
    int tmp = k % 10;
    if (tmp == 8) return 1;
    k /= 10;
  }
  return 0;
}
int main(void) {
  long long n, res = 0;
  cin >> n;
  int i = 0;
  while (1) {
    i++;
    if (OK(n + i)) {
      cout << i << endl;
      return 0;
    }
  }
  return 0;
}
