#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
struct block_t {
  int beg, end;
  char ch;
};
int main() {
  int N;
  string S = "###..#..";
  cin >> N;
  int beg = 0;
  char prev = S.front();
  vector<block_t> block;
  for (int i = 0; i < N; i++) {
    if (S[i] != prev) {
      block.push_back({beg, i, prev});
      beg = i;
    }
    if (i == N - 1) {
      block.push_back({i, i + 1, S[i]});
    }
    prev = S[i];
  }
  ll cnt = 0;
  auto it = block.cbegin();
  if (it->ch == '.') it++;
  while (it != block.cend() - 1 && it != block.cend()) {
    int blackCnt = it->end - it->beg;
    int whiteCnt = (it + 1)->end - (it + 1)->beg;
    cnt += (blackCnt < whiteCnt) ? blackCnt : whiteCnt;
    it += 2;
  }
  cout << cnt;
  return 0;
}
