#include <bits/stdc++.h>
int eight(int a) {
  for (;;) {
    if ((a % 10 == 8) || (a % 10 == -8) || (a == 8)) return 1;
    a = a / 10;
    if (a == 0) return 0;
  }
  return 0;
}
int main() {
  int a, b, t;
  scanf("%d", &a);
  t = a;
  if (a > -8 && a <= 1)
    b = 8 - a;
  else {
    for (;;) {
      if (eight(a++) == 1) {
        b = a - t - 1;
        break;
      }
    }
  }
  if (b == 0) {
    for (;;) {
      if (eight(a++) == 1) {
        b = a - t - 1;
        break;
      }
    }
  }
  printf("%d", b);
  return 0;
}
