---
# System prepended metadata

title: Untitled

---

```
public int FindNumber(string n) {
    List<String> lis = new List<String>(n.Split(' '));
	int l = lis.Count;
    List<int> s = new List<int> {0};
    for (int i = 0; i < l; i++) {
        String a = lis[i];
        String k = "";
        foreach (char c in a) {
            if (c != ',') {
                k += c;
            }
        }
        s.Add(int.Parse(k));
    }
    int d = s.Count - 1;
    int x = 0;
    if (d % 2 != 0) {
        x = (s[d-1] + s[d-2]) * 2 - s[d];
    } else {
        x = (s[d] + 1);
    }
    return x;
}
```