#include <bits/stdc++.h>
int main() {
  long long int num, i, j, k, x, flag = 0;
  scanf("%I64d", &num);
  for (i = 1; i <= 20; i++) {
    x = num + i;
    if (x < 0) x = x * (-1);
    while (x != 0) {
      if (x % 10 == 8) {
        flag = 1;
        goto here;
      }
      x = (x - (x % 10)) / 10;
    }
  }
here:
  printf("%I64d", i);
}
