#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N, r, c = 0;
  cin >> N;
  c = 1;
  N++;
  bool flag = false;
  while (1) {
    r = N;
    if (r < 0) r *= -1;
    while (r > 0) {
      if (r % 10 == 8) {
        flag = true;
        break;
      }
      r /= 10;
    }
    if (flag) {
      break;
    }
    N++;
    c++;
  }
  cout << c;
  return 0;
}
