#include <bits/stdc++.h>
using namespace std;
int main() {
  long a, c;
  cin >> a;
  for (int b = 1; b <= 16; b++) {
    c = a + b;
    while (c) {
      if (c % 10 == 8 || c % 10 == -8) {
        cout << b;
        return 0;
      }
      c /= 10;
    }
  }
  return 0;
}
