#include <iostream>
#include <cmath>

using namespace std;

int main(){
    int n, i;
    double s = 1;

    cout << "Input N: ";
    cin >> n;

    if (n < 1){
        cout << "N must be positive." << endl;
        return 0;
    }

    i = 1;
    while (i <= n){
        s = s + (pow(-1, i) * (1 / pow(2, i)));
        i++;
    }

    cout << "Function result: " << s << endl;

    return 0;
}