[Question]
  [
This is a problem from [NCPC 2005](https://ncpc.idi.ntnu.no/ncpc2005/). Roy has
an apartment with only one single electrical outlet, but he has a bunch of power strips.
Compute the maximum number of outlets he can have using the power strips he
has. The number of outlets per power strip is given as input.
It turns out that if the number of outlets of the strips respectively are
$$p\_1, p\_2, \dots, p\_n$$
then the number of outlets is
$$1 - n + \sum\_i p\_i$$ ,
or
$$1 + p\_1-1 + p\_2-1 + \dots + p\_n-1$$.
**The input to the *program or function* is a non-empty series of positive integers.**
## Examples
```
2 3 4
> 7
2 4 6
> 10
1 1 1 1 1 1 1 1
> 1
100 1000 10000
> 11098
```
  
[Answer]
## [Retina](https://github.com/mbuettner/retina/), 3 bytes
```
 1
```
The trailing linefeed is significant.
Input is a space-separated list of [unary numbers](http://meta.codegolf.stackexchange.com/questions/5343/can-numeric-input-output-be-in-unary).
[Try it online!](http://retina.tryitonline.net/#code=IDEK&input=MTEgMTExMSAxMTExMTE)
### Explanation
The code simply removes all spaces as well as the `1` after them from the string. Here is why that works:
Addition in unary is simple: just concatenate the numbers which is the same as removing the delimiters. Decrementing by 1 is also simple: just remove a `1` from each number. We want 1 more than the sum of the decremented inputs though, so we simply only remove the `1`s we find after spaces, thereby decrementing all but the first input.
[Answer]
# Jelly, 3 bytes
```
‚ÄôS‚Äò
```
Decrement (all), sum, increment. [Try it here.](http://jelly.tryitonline.net/#code=4oCZU-KAmA&input=&args=Miw0LDY)
[Answer]
## [Hexagony](https://github.com/mbuettner/hexagony), ~~18~~ 14 bytes
```
.?<_(@'")>{+.!
```
Unfolded:
```
  . ? <
 _ ( @ '
" ) > { +
 . ! . .
  . . .
```
[Try it online!](http://hexagony.tryitonline.net/#code=ICAuID8gPAogXyAoIEAgJwoiICkgPiB7ICsKIC4gISAuIC4KICAuIC4gLg&input=MiA0IDY)
I don't think side-length 2 is possible, but there ~~must~~ might be a more efficient side-length 3 solution that this.
This is the usual "decrement all, sum, increment" approach, but I'll have to add diagrams later to show how exactly it works in Hexagony.
[Answer]
## Python, 24 bytes
```
lambda*n:1-len(n)+sum(n)
```
[Try it online](http://ideone.com/fork/DTMBwR)
[Answer]
# Mathematica, 9 bytes
```
Tr[#-1]+1&
```
[Answer]
## Haskell, ~~17~~ 15 bytes
```
foldl1$(+).pred
```
Usage example: `( foldl1$(+).pred ) [2,4,6]` -> `10`.
Old version, different approach, 17 bytes: `succ.sum.map pred`.
[Answer]
# J, 6 bytes
```
+/+1-#
```
Sum plus one minus length. Parenthesize and apply it, like so:
```
   (+/+1-#) 2 3 4
7
```
[Answer]
## [Labyrinth](http://github.com/mbuettner/labyrinth), 9 bytes
```
"?;)!@
+(
```
[Try it online!](http://labyrinth.tryitonline.net/#code=Ij87KSFACiso&input=MiA0IDY)
The usual primer:
* Labyrinth is 2D and stack-based. Stacks have an infinite number of zeroes on the bottom.
* When the instruction pointer reaches a junction, it checks the top of the stack to determine where to turn next. Negative is left, zero is forward and positive is right.
Here we start at the top left `"`, a no-op, heading rightward. Next is `?`, which reads an int from STDIN (throwing away chars it can't parse as an integer, e.g. spaces). Now we have two cases:
If the input is positive, we turn right, performing:
```
(            decrement top of stack
+            add top two stack elements
             [continue loop]
```
If the input is zero (which occurs at EOF), we go straight ahead, performing:
```
;            pop zero from EOF
)            increment top of stack
!            output top of stack as number
@            halt program
```
[Answer]
# Pyth, 5 bytes
```
hstMQ
```
increment(sum(map(decrement, input)))
[Answer]
## ES6, 25 bytes
```
a=>a.map(n=>r+=n-1,r=1)|r
```
[Answer]
# MATL, 3 bytes
```
qsQ
```
[Try it online.](http://matl.tryitonline.net/#code=cXNR&input=WzIsMyw0XQ)
## Explanation
```
qsQ
q      thread decrement over the input array
  s    sum
   Q   increment
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 4 bytes
Code:
```
E<O>
```
Explanation:
```
E     # Evaluates input
 <    # Decrement on list
  O   # Compute the total sum
   >  # Increment on the sum
      # Implicit: output top of the stack
```
Takes input like an array (e.g. `[3, 4, 5]`).
[Answer]
## [Starry](https://esolangs.org/wiki/Starry), ~~26~~ 24 bytes
```
, + '`      + ** `, +'*.
```
Expects newline-separated integers. [Try it online!](http://starry.tryitonline.net/#code=LCArICdgICAgICAgKyAqKiBgLCArJyou&input=MTAwCjEwMDAKMTAwMDA)
Thanks to @MartinB√ºttner for -2 bytes.
```
,           Read line as integer
 + '        Dupe and jump to label 1 if nonzero
`           Set label 0
      +     Push 1
 *          Sub
*           Add
 `          Set label 1
,           Read line as integer
 + '        Dupe and jump to label 0 if nonzero
*           Add
.           Output as integer
```
The loop is unrolled so that the first number is not decremented, negating the need to increment. Pushing numbers is expensive in Starry...
[Answer]
# Bash + GNU utilities, 16
If there are `N` power strips, then there should be `N-1` separators in the comma-separated input list. All we need to do is replace the separators with `- 1 +` and arithmetically evaluate:
```
sed s/,/-1+/g|bc
```
Or using the same trick:
# Pure Bash (no external utilities), 19
```
echo $[${1//,/-1+}]
```
[Answer]
# APL (NARS 2000), ~~13~~ 10 bytes
`{1+(+/‚çµ)-‚ç¥‚àä‚çµ}`
Edit: Down to 10 with Lynn's (better) approach.
`{1++/1-‚ç®‚çµ}`
[Answer]
# gs2, 5 bytes
(CP437-encoded.)
```
W&Œ¶d'
```
That‚Äôs `read-nums dec m1 sum inc`.
[Answer]
## CJam, 7 bytes
```
q~:(:+)
```
[Test it here.](http://cjam.aditsu.net/#code=q~%3A(%3A%2B)&input=%5B2%204%206%5D)
Same approach as Lynn's (decrement all, sum, increment). This also works for 8 bytes (and is maybe a bit more interesting):
```
q~{(+}*
```
This folds "decrement, add" over the list. By doing that, the decrement is only applied to all elements except the first, such that we don't need to take care of the increment separately.
[Answer]
# C, ~~60~~ ~~59~~ 55 bytes
```
x;main(s){while(~scanf("%i",&x))s+=x-1;printf("%i",s);}
```
[Answer]
# Perl 6, 14 bytes
```
{1+[+] --¬´@_}
```
**usage** 
```
my &f = {1+[+] --¬´@_}
say f([2,3,4]) # 7
say f([2,4,6]) # 10
say f([1,1,1,1,1,1,1,1]) # 1
say f([100,1000,10000]) # 11098
```
[Answer]
## Seriously, 7 bytes
```
,;l@Œ£-u
```
[Try it online!](http://seriously.tryitonline.net/#code=LDtsQM6jLXU&input=MiwzLDQ)
Explanation:
```
,;l@Œ£-u
,        push input
 ;       dupe
  l@     push length (n), swap
    Œ£-u  push sum, subtract n, add one
```
[Answer]
# [Mornington Crescent](https://github.com/padarom/esoterpret),  ~~1909 1873~~  1839 bytes
```
Take Northern Line to Stockwell
Take Victoria Line to Seven Sisters
Take Victoria Line to Victoria
Take Circle Line to Victoria
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Hammersmith
Take Circle Line to Cannon Street
Take Circle Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Hammersmith
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Turnham Green
Take District Line to Hammersmith
Take District Line to Turnham Green
Take District Line to Notting Hill Gate
Take Circle Line to Notting Hill Gate
Take Circle Line to Bank
Take Circle Line to Embankment
Take Northern Line to Stockwell
Take Northern Line to Embankment
Take Circle Line to Temple
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Blackfriars
Take Circle Line to Embankment
Take District Line to Parsons Green
Take District Line to Bank
Take Circle Line to Hammersmith
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Upminster
Take District Line to Becontree
Take District Line to Parsons Green
Take District Line to Embankment
Take Circle Line to Blackfriars
Take Circle Line to Bank
Take Northern Line to Angel
Take Northern Line to Bank
Take Circle Line to Bank
Take District Line to Upminster
Take District Line to Bank
Take Circle Line to Bank
Take Northern Line to Mornington Crescent
```
[Try it online!](https://tio.run/##zVXBTsMwDL3vK8IdPoIVtB5gmrQC5xDMGjWxJ9fA5w8PtFZaWxpAlXrNc16c5/eSSIwed0J45RhqByiHQ2ErMGtiKYHR3HkEI2S2Qq76gBAWX/ijd0LsbYvDO6DZ@lqA64Ga08I3nHl2AdLApcWqF8htjHpg9FL24plFJO1LGEAmYkhv7kblYb1nU/Gwjx6Pkg3g/2dYgiM89j7T/cUbY2mjWWkJ/lmFFJY1iajZTe5DMCsr0DuztKrBkd/GZ4WiBmmRlKMOfk5wxl9A3AeYyG1z98oyWFe96htxemFGxO8QbHQnYf2jTSZM89z1TZFnxJ9jI2rV7Tj/GncwlIrBobTA79UY5@z0cd98mCZrPsxc00yX5ok4vFx8Ag "Mornington Crescent ‚Äì Try It Online")
[Answer]
# [Perl 6](http://perl6.org), 20 bytes
```
put 1+sum --¬´@*ARGS
```
( You can use `<<` instead of `¬´` )
### Usage:
```
$ perl6 -e 'put 1+sum --¬´@*ARGS' 100 1000 10000
11098
```
[Answer]
# Perl 5 23+2=25 or 19+2=21
Requires `-ap` flags:
```
map{$.+=($_-1)}@F;$_=$.
```
Saved in a file and run as
```
perl -ap file.pl
```
EDIT: Another answer, smaller (19+2) but basically copied from dev-null answer:
```
$.+=$_-1for@F;$_=$.
```
[Answer]
## F#, 25 bytes
```
Seq.fold(fun s n->s+n-1)1
```
This is a function that takes in an array/list/sequence of integers and returns the required result.
### How it works:
`Seq.fold` allows you to apply a function to every element of a sequence while carrying some state around while it does so. The result of the function as applied to the first element will give the state that will be put into the function for the second element, and so forth. For example, to sum up the list `[1; 3; 4; 10]`, you'd write it like this:
```
Seq.fold (fun sum element -> sum + element) 0 [1; 3; 4; 10]
         (       function to apply        ) ^ (sequence to process)
                                     ( initial state )
```
Which would be applied like so:
```
// First, initial state  + first element
0 + 1  = 1
// Then, previous state + next element until the end of the sequence
1 + 3  = 4
4 + 4  = 8
8 + 10 = 18
```
With the last state being the return value of `Seq.fold`.
[Answer]
# ùîºùïäùïÑùïöùïü, 5 chars / 7 bytes
```
√Ø‚í≠+‚Ä°_
```
`[Try it here (Firefox only).](http://molarmanful.github.io/ESMin/interpreter3.html?eval=true&input=%5B2%2C3%2C4%5D&code=%C3%AF%E2%92%AD%2B%E2%80%A1_)`
Uses a custom encoding with 10-bit chars (thx @Dennis!). Run `encode('√Ø‚í≠+‚Ä°_')` in the JS console to get encoded form, and `decode(/*ENCODED TEXT HERE*/)` to decode encoded form.
# Explanation
Translates to Javascript ES6 as:
```
i=>i.reduce(($,_)=>$+--_)
```
[Answer]
## Python 3, 79 bytes
```
import sys
print(sum(map(lambda x: int(x)-1, sys.stdin.readline().split()))+1)
```
[Answer]
## Ruby, 30 bytes
```
$*.inject(1){|s,v|s+=v.to_i-1}
```
Simple enough - starting from 1, add up the supplied numbers, each -1 (command line args are in `$*`). Shame `inject` is such a long word.
[Answer]
## PowerShell, 19 bytes
```
$args-join'-1+'|iex
```
Note that `1 + p1-1 + p2-1 + ... + pn-1` is equivalent to `p1-1 + p2-1 + ... + pn`.
Takes input as separate command-line arguments with `$args`. We `-join` those together with a `-1+` delimiter to create a string, such as `2-1+3-1+4`. The string is then piped to `Invoke-Expression` (similar to `eval`), and outputs the result.
[Answer]
## Perl, 21 + 2 = 23 bytes
```
$a+=$_-1for@F;say++$a
```
Requires `-a` and `-E`:
```
$ perl -aE'$a+=$_-1for@F;say++$a'<<<'2 3 4'
7
```
[Answer]
## Brainfuck, 15 bytes
Assumption: The , operator returns 0 once all input has been exhausted, and there are no extension cords with 0 plugs. Also, the IO needs to be in byte values instead of ASCII character codes.
```
+>,[-[-<+>],]<.
```
Explanation:
This uses 2 registers. A "Value" accumulator register, representing the number of devices that can be plugged in, and a "current cord" register that keeps track of the value of the current cord. It starts off by incrementing the value by 1, for the existing outlet. Then, for each extension cord, it subtracts one from the value since a plug is being taken up, then increments the value by the number of plugs.
Most online interpreters don't operate in raw byte input mode. To test it online, use this code:
```
+>,[->-[>+<-----]>---[-<+>]<[-<->]<[-<+>],]<.
```
]