#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long int n;
  cin >> n;
  long int num;
  int flag = 0;
  if (n > 0) {
    for (int i = 1; i <= 10; i++) {
      num = n + (long int)i;
      while (num != 0) {
        if (num % 10 == 8) {
          flag = 1;
          break;
        } else {
          num = num / 10;
        }
      }
      if (flag == 1) {
        i ? cout << i : cout << 10;
        break;
      }
    }
  } else if (n >= -8) {
    int count = 0;
    while (n != 8) {
      count++;
      n += 1;
    }
    cout << count;
  } else {
    n = n * -1;
    for (int i = 1; i <= 10; i++) {
      num = n - (long int)i;
      while (num != 0) {
        if (num % 10 == 8) {
          flag = 1;
          break;
        } else {
          num = num / 10;
        }
      }
      if (flag == 1) {
        i ? cout << i : cout << 10;
        break;
      }
    }
  }
  return 0;
}
