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