#include <fstream>
#include <iostream>
using namespace std;
int main()
{
    ifstream f1("fibonaci.inp");
    ofstream f2("fibonaci.out");
    __int64 a[100];
    float tbc;
    int n,d = 1,dem = 0,tong;
    f1>>n;
    a[0] = 1; a[1] = 1;
    tong = a[0] + a[1];
    while (a[d] <= n)
    {
        d++;
        a[d] = a[d-1] + a[d-2];
        tong = tong + a[d];
    }
    tbc = (tong - a[d])/d;
    for (int i = 0; i < d; i++)
    {
        f2<<a[i]<<" ";
        if (a[i] > tbc) dem++;
    }
    f2<<endl;
    f2<<dem;
    return 0;
}
