#include <bits/stdc++.h>
int main() {
  long long int hold, a, b, d = 0, num;
  scanf("%I64d", &num);
  a = num;
  while (1) {
    num++;
    b = num;
    while (b != 0) {
      hold = b % 10;
      b /= 10;
      if (abs(hold) == 8) {
        d = 1;
        break;
      }
    }
    if (d == 1) {
      break;
    }
  }
  printf("%I64d", num - a);
  return 0;
}
