#include <bits/stdc++.h>
bool cek(int a) {
  if (a < 0) a = a * -1;
  while (a > 0) {
    if (a % 10 == 8) return true;
    a /= 10;
  }
  return false;
}
int main() {
  int a, ans = 0;
  scanf("%d", &a);
  while (1) {
    if (cek(a) && ans > 0) {
      printf("%d\n", ans);
      break;
    }
    ans++;
    a++;
  }
  return 0;
}
