All Tracks Basic Programming Implementation Basics of Implementation Problem

Special numbers
/

Basic Number Theory-1, Basic Programming, Math

Problem
Editorial
Analytics

A natural number is special if it consists of only digits \(4\) and \(7\). Find the number of pairs of сoprime special numbers \((x,\ y)\) such that \(1 ⩽ x ⩽ y ⩽ N\)

Input format

The first line contains an integer \(N\) (\(1 ⩽ N ⩽ 10^9\)).

Output format

Print a single number denoting the answer to the problem.

SAMPLE INPUT
10
SAMPLE OUTPUT
1
Explanation

Clarification: https://en.wikipedia.org/wiki/Coprime_integers

Answer = 1 because 4 and 7 \(\le\) 10 and gcd(4,7) = 1

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?