#include <bits/stdc++.h>
using namespace std;
const int inf = ~0u >> 2;
const int MOD = 1e9 + 7;
const int N = 1e5 + 10;
long long n, ans;
char a[20];
int main() {
  ios_base::sync_with_stdio(0);
  while (cin >> n) {
    for (long long i = n + 1; i < ((long long)9e9 + 1); ++i) {
      sprintf(a, "%I64d", i);
      if (strchr(a, '8')) {
        ans = i - n;
        break;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
