#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int no, k = 1;
  cin >> no;
  long long int i = 0;
  while (1) {
    i++;
    no = no + 1;
    if (no < 0)
      k = (-1) * no;
    else
      k = no;
    if (k == 0) continue;
    while (k != 0) {
      int temp = k % 10;
      if (temp == 8) {
        cout << i << endl;
        exit(0);
      }
      k /= 10;
    }
  }
  return 0;
}
